How can I get a Java readable JSON String result from python client?


#1

I use python elasticsearch client , but the search results are passed to a Java code to be used.
The problem is ES python client returns a JSON String in python format ( keys are surrounded by single quotes , therefore double quotes are not escaped etc...)
Do I need to manually create a String that is readable by Java ?

ex : [ { u'proc': [ { u'read' :u'["/usr/share/a.txt"]', . ....


(Magnus B├Ąck) #2

That's not a JSON string, that's a string representation of a Python data structure. Convert it to a JSON string with e.g. json.dumps() and you'll be fine.


#3

Thank you very much...you saved my day!! :relaxed:


(system) #4