codeluaeveryday Posted March 8, 2013 Share Posted March 8, 2013 Ok, so it's kind of simple, the fromJSON function is meant to convert json formatted strings to tables aight? well it's not working for me. I called an API and returned a JSON formatted string, well when I use fromJSON it returns nil. Example String downloaded: {"data":{"detections":[{"language":"es","isReliable":false,"confidence":0.4517133956386293},{"language":"pt","isReliable":false,"confidence":0.08356545961002786}]}} returns : Nil I am going to be comparing the confidence, I even worked on my own parser, failed and I want to quit life. Care to explain how this isn't working. Link to comment
-ffs-Sniper Posted March 8, 2013 Share Posted March 8, 2013 You need to add [ ] brackets to the beginning and the end of any JSON string in MTA. Tested and works. yourTable = fromJSON('[{"data":{"detections":[{"language":"es","isReliable":false,"confidence":0.4517133956386293},{"language":"pt","isReliable":false,"confidence":0.08356545961002786}]}}]') Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now