-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON Parsing Failed #278
Comments
Try removing the single quotes from around the keys (data, type, khz) and see if that helps |
Hey, alright. That got me somewhere. Thanks for the tip! |
Actually, I spoke too soon. The JSON parsing now works in the UI, however. the LED isn't transmitting. The new serial output shows the transmitting string is null, so it appears to me that the new JSON string is breaking somewhere else:
The LED transmits fine if I use one of the built-in codes, e.g.; |
Remove the double quotes from the array |
That's the rub - it returns the parsing error without the double quotes around the array (even with no single quotes around the keys, as suggested). I tried replacing the doubles with single quotes as well and while it doesn't return the parsing error, it also returns null. |
Does it work if you put the individual numbers in quotes? |
Negative. These fail json validation, as do other various permutations of quotes around the keys and values: It seems that the URL json validation is contingent upon placing the 'data' values in double quotes. |
Alright I was able to get it to work using this format
But the issue is that the JSON parsing error was due to lack of memory. I just pushed an update that expands the allocated memory to accommodate raw commands of this size. I also improved the error logging to include why the json parsing error was flagged since that can be misleading |
You nailed it. Works like a champ now. Thanks for your help on this. |
Hi, there! I'm glad I found this project as I'd like to get Alexa to control my Honeywell tower fan via IR. They don't seem to re-use Sony codes like a lot of appliances do, so I need to send the raw command.
I'm attempting to use the URLs generated on the received code screen and they return 'Error! JSON parsing failed'.
Until I get this up and running, I left the password and Amazon user ID fields empty.
Here's an example URL string:
http://192.168.1.50:80/json?plain=[{'data':[1278,438,1252,436,410,1280,1250,442,1276,418,410,1284,408,1284,408,1286,408,1284,1252,440,410,1284,408,8768,1278,436,1254,438,410,1280,1250,440,1252,414,436,1284,408,1286,408,1286,408,1284,1252,440,410,1284,408,8768,1278,438,1252,436,412,1280,1250,440,1252,440,412,1284,408,1286,408,1284,410,1284,1252,442,408,1286,410,8768,1278,406,1284,438,408,1280,1252,440,1252,442,408,1286,408,1284,408,1286,408,1286,1250,442,408,1286,408,8768,1278,436,1254,438,408,1280,1252,440,1250,444,408,1284,408,1284,408,1284,408,1286,1250,444,410,1284,408,8766,1278,438,1252,436,410,1280,1252,440,1252,442,408,1284,408,1284,408,1286,408,1286,1250,442,410,1284,408,8770,1278,438,1252,436,410],'type':'raw','khz':38}]
The serial output looks like this (snipped the header stuff):
New client request: GET /json?plain=[{'data':[1278,438,1252,436,410,1280,1250,442,1276,418,410,1284,408,1284,408,1286,408,1284,1252,440,410,1284,408,8768,1278,436,1254,438,410,1280,1250,440,1252,414,436,1284,408,1286,408,1286,408,1284,1252,440,410,1284,408,8768,1278,438,1252,436,412,1280,1250,440,1252,440,412,1284,408,1286,408,1284,410,1284,1252,442,408,1286,410,8768,1278,406,1284,438,408,1280,1252,440,1252,442,408,1286,408,1284,408,1286,408,1286,1250,442,408,1286,408,8768,1278,436,1254,438,408,1280,1252,440,1250,444,408,1284,408,1284,408,1284,408,1286,1250,444,410,1284,408,8766,1278,438,1252,436,410,1280,1252,440,1252,442,408,1284,408,1284,408,1286,408,1286,1250,442,410,1284,408,8770,1278,438,1252,436,410],'type':'raw','khz':38}] HTTP/1.1
method: GET url: /json search: plain=[{'data':[1278,438,1252,436,410,1280,1250,442,1276,418,410,1284,408,1284,408,1286,408,1284,1252,440,410,1284,408,8768,1278,436,1254,438,410,1280,1250,440,1252,414,436,1284,408,1286,408,1286,408,1284,1252,440,410,1284,408,8768,1278,438,1252,436,412,1280,1250,440,1252,440,412,1284,408,1286,408,1284,410,1284,1252,442,408,1286,410,8768,1278,406,1284,438,408,1280,1252,440,1252,442,408,1286,408,1284,408,1286,408,1286,1250,442,408,1286,408,8768,1278,436,1254,438,408,1280,1252,440,1250,444,408,1284,408,1284,408,1284,408,1286,1250,444,410,1284,408,8766,1278,438,1252,436,410,1280,1252,440,1252,442,408,1284,408,1284,408,1286,408,1286,1250,442,410,1284,408,8770,1278,438,1252,436,410],'type':'raw','khz':38}]
<...>
args: plain=[{'data':[1278,438,1252,436,410,1280,1250,442,1276,418,410,1284,408,1284,408,1286,408,1284,1252,440,410,1284,408,8768,1278,436,1254,438,410,1280,1250,440,1252,414,436,1284,408,1286,408,1286,408,1284,1252,440,410,1284,408,8768,1278,438,1252,436,412,1280,1250,440,1252,440,412,1284,408,1286,408,1284,410,1284,1252,442,408,1286,410,8768,1278,406,1284,438,408,1280,1252,440,1252,442,408,1286,408,1284,408,1286,408,1286,1250,442,408,1286,408,8768,1278,436,1254,438,408,1280,1252,440,1250,444,408,1284,408,1284,408,1284,408,1286,1250,444,410,1284,408,8766,1278,438,1252,436,410,1280,1252,440,1252,442,408,1284,408,1284,408,1286,408,1286,1250,442,410,1284,408,8770,1278,438,1252,436,410],'type':'raw','khz':38}] args count: 1 Request: /json
final list of key/value pairs: key:'plain' value:'[{'data':[1278,438,1252,436,410,1280,1250,442,1276,418,410,1284,408,1284,408,1286,408,1284,1252,440,410,1284,408,8768,1278,436,1254,438,410,1280,1250,440,1252,414,436,1284,408,1286,408,1286,408,1284,1252,440,410,1284,408,8768,1278,438,1252,436,412,1280,1250,440,1252,440,412,1284,408,1286,408,1284,410,1284,1252,442,408,1286,410,8768,1278,406,1284,438,408,1280,1252,440,1252,442,408,1286,408,1284,408,1286,408,1286,1250,442,408,1286,408,8768,1278,436,1254,438,408,1280,1252,440,1250,444,408,1284,408,1284,408,1284,408,1286,1250,444,410,1284,408,8766,1278,438,1252,436,410,1280,1252,440,1252,442,408,1284,408,1284,408,1286,408,1286,1250,442,410,1284,408,8770,1278,438,1252,436,410],'type':'raw','khz':38}]'
Connection received - JSON
JSON parsing failed
Any thoughts? The libraries are up-to-date and they compiled fine with just some nonfatal warnings about deprecated declarations. I'm using the /dev branch as I had the issue on my WEMOS D1 Mini where the web server was freezing after about 5 seconds. I also noticed that Chrome likes to be helpful and encode some of the characters in the URL, where Edge does not. So I've been using Edge to keep things simple.
Thanks for your help.
-James
The text was updated successfully, but these errors were encountered: