Dear Jasem.
I working on apps for my raspberry and meet some issue to parse the reply from the APIs.
Replies are provided between braket "[ ]" and my parsing (With libjson0) failed. From the
www.json.org/
it looks not correct to have the [ ] at objet level. The first level is an objet and should be between curled "{ }" only at value level we could use bracket for array information.
If I modified, for exemple, the # Server status
from :
@app.get('/api/server/status')
def get_server_status():
status = [ { 'status' : str(isServerRunning()) } ]
json_string = json.dumps(status)
return json_string
to:
@app.get('/api/server/status')
def get_server_status():
status = { 'status' : str(isServerRunning()) }
json_string = json.dumps(status)
return json_string
The parser works fine.
Do I misunderstand the explanation from the Internet site behind? or may I ask you to correct the APIs?
EDIT: But the js script doesn't like it! for me looks quite strange, but I don't understand the js code.
Regards
Philippe