Hi All- I have made a JAVA program that calls Tone Analyzer API and returns output in JSON. I have a client (call it client 1) calling for this JSON through REST. Now the problem I am facing is that the format in which client 1 is expecting JSON and what is given by Tone Analyzer is different, hence JSON is not processed by the client.
Details- Tone Analyzer gives following input for emotional tone. Now, I dont need the words document_tone, tone_categories, category id, category_name, and [ ] - braces. (I am only using emotional tone method so the client knows what to expect and hence there is no need for this metadata). How can I achieve this ? Please help. I am hoping that there is a way to do this at Tone analyzer end as I have a limited capability to alter metadata at client end.
Further I also understand that object called - ToneAnalysis contains JSON response of tone analyzer. But I dont know if there is a parameter I can set so that above mentioned text and [ ] (these kind of braces ) dont appear.
Details of the Tone Analysis Object: https://console.bluemix.net/docs/services/tone-analyzer/using-tone.html#JSONresponse
Sample Output of Tone Analyzer
{ "document_tone": { "tone_categories": [ { "category_id": "emotion_tone", "category_name": "Emotion Tone", "tones": [ { "tone_id": "anger", "tone_name": "Anger", "score": 0.0 }, { "tone_id": "disgust", "tone_name": "Disgust", "score": 0.0 }, { "tone_id": "fear", "tone_name": "Fear", "score": 0.0 }, { "tone_id": "joy", "tone_name": "Joy", "score": 0.0 }, { "tone_id": "sadness", "tone_name": "Sadness", "score": 0.0 } ] } ] } }
Thanks again Vivek