StringReplace(...
Hey guys, Having an issue with getting data from WebRequest's JSON response. I know, I know, this is probably a common issue, but I can't figure it out.
This is the results array response from WebRequest: [{"instrument":"EURUSD","price":"1.08690","date_added":"2020-04-18"},{"instrument":"EURUSD","price":"1.08700","date_added":"2020-04-18"},{"instrument":"EURUSD","price":"1.08900","date_added":"2020-04-18"},{"instrument":"EURUSD","price":"1.09000","date_added":"2020-04-18"}]
I'm using this parser from ydrol to try to read the JOSN. Problem is, with the quotations not escaped, running something like results[0] doesn't get the first JSON element like this: {"instrument":"EURUSD","price":"1.08690","date_added":"2020-04-18"} but instead gets the first character. The parser handles the JSON just fine when I give it that during testing.
in testing, if I manually escape each of the quotations, it works fine.
my question: I guess this is an encoding issue, so how do I handle for encoding? This has to be a simple fix, something I'm overlooking...
I assume this is an issue in testing because you are probably setting a variable to the json string, am I right? For testing you should read the JSON string from a file instead of your source code, because you will have to manually escape all quotes in your source for it to work.
I assume this is an issue in testing because you are probably setting a variable to the json string, am I right? For testing you should read the JSON string from a file instead of your source code, because you will have to manually escape all quotes in your source for it to work.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey guys, Having an issue with getting data from WebRequest's JSON response. I know, I know, this is probably a common issue, but I can't figure it out.
This is the results array response from WebRequest: [{"instrument":"EURUSD","price":"1.08690","date_added":"2020-04-18"},{"instrument":"EURUSD","price":"1.08700","date_added":"2020-04-18"},{"instrument":"EURUSD","price":"1.08900","date_added":"2020-04-18"},{"instrument":"EURUSD","price":"1.09000","date_added":"2020-04-18"}]
I'm using this parser from ydrol to try to read the JOSN. Problem is, with the quotations not escaped, running something like results[0] doesn't get the first JSON element like this: {"instrument":"EURUSD","price":"1.08690","date_added":"2020-04-18"} but instead gets the first character. The parser handles the JSON just fine when I give it that during testing.
in testing, if I manually escape each of the quotations, it works fine.
my question: I guess this is an encoding issue, so how do I handle for encoding? This has to be a simple fix, something I'm overlooking...