Closed Oliv4945 closed 7 years ago
Jarvis expects only 1 object (one command at a time) Jarvis outputs an array because there can be many lines (many answers, verbose mode, ...)
@Oliv4945 so why an array? Are there several commands to process? Or is it because Android spits JSON arrays by default?
If you use Android API for JSON requests you have object or array not both, but I finally use simple http request and encode/parse JSON myself. It is really easy to change the code to be able to use both, i will send a PR but want to work again on Repseaker before.
Hi,
Jarvis-api
waits for a JSON object in POST request, but sends back a JSON array. It might be more consistent (and helpful for the Android app :-) ) to have a JSON array in input. The problem is for all software already developed. I see two options:order_json_array
isintance(obj, list) # if returns true, then JSON Array
isintance(obj, dict) # if returns true, then JSON Object
Request in JSON object:
{"order":"test","key":"testtest"}
Answer in JSON array:[{"Jarvis":"Ca fonctionne!"}]