-4

I am using parallelbots api to get sentiment analysis and in python the api returned

{u'probabilities': {u'positive': 0.214111, u'neutral': 0.66828, u'negative': 0.11761}, u'usage': u'By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions', u'sentiment': u'neutral'}

Is this a unicode format or some other, how to convert it into JSON so that i can use it in JS

Narendra Reddy
  • 135
  • 1
  • 10
  • That's a dictionary, with [unicode strings](https://stackoverflow.com/q/2464959/3001761). Did you look into Python's `json` module? – jonrsharpe Oct 06 '17 at 16:30

1 Answers1

-1

Use python json module, json.dumps().

import json
data = {u'probabilities': {u'positive': 0.214111, u'neutral': 0.66828, u'negative': 0.11761}, u'usage': u'By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions', u'sentiment': u'neutral'}
print data
data = json.dumps(data)
print data
Dharmesh Fumakiya
  • 2,276
  • 2
  • 11
  • 17