Jan-21-2020, 06:23 AM
I am trying to send a dict file in JSON fromat usin "ujson.dumps" method to local http server. After executing ujson.dumps the output get changes.
This is my code
This is my code
import ujson file ={ "success": true, "status_code": 200, "version": "1.2.0003", "path": "/get_capture_options", "method": "GET", "capture_options": [ { "width": 1920, "framerate": 30, "height": 1080 }, { "width": 1280, "framerate": 30, "height": 720 }, { "width": 1280, "framerate": 60, "height": 720 }, { "width": 640, "framerate": 30, "height": 480 }, { "width": 640, "framerate": 60, "height": 480 }, { "width": 640, "framerate": 90, "height": 480 } ] } file2 = ujson.dumps(file).encode('utf-8') print(file2)This is the output:
Quote: b'{"success":true,You can seen in path parameter the "\\" added. Why is this happening? how to solve this? Please help.
"status_code":200,
"method":"GET",
"path":"\\/get_capture_options",
"version":"1.2.0003",
"capture_options":[{"width":1920,"height":1080,"framerate":30},
{"width":1280,"height":720,"framerate":30},
{"width":1280,"height":720,"framerate":60},
{"width":640,"height":480,"framerate":30},
{"width":640,"height":480,"framerate":60},
{"width":640,"height":480,"framerate":90}]}'