On 12/30/2016 05:27 PM, Matt Maier wrote:
I'm trying to send a list of strings to an API. Best I can tell it's
interpreting the entire list as one string. Is there a way to send data to
easyJSON such that it returns a JSON list of strings instead of one
monolithic string?
For example, I've got something like this:
array[one] = 12345,12345,12345
array[two] = 12345,12345
and what I get back from easyJSON is this:
{"one":"12345,12345,12345","two":"12345,12345"}
when what I'm trying to get is more like this
{"one":["12345","12345","12345"],"two":["12345","12345"]}
Well, technically this isn't really a "problem"...
The json object you're returning is exactly what you put into the array.
The first is a string of 17 characters, the second of 11 characters.
The commas are just characters in a string, nothing special.
However, as both you and Richard point out, LC's lack of true strings is
limiting.
You might try something like this:
put 12345,"hello",12345 into tElement
split tElement by comma
put tElement into tArray["one"]
put 12345,12345 into tElement
split tElement by comma
put tElement into tArray["two"]
put jsonFromArray(tArray)
result: {"one":[12345,"hello",12345],"two":[12345,12345]}
Q: Do you really want the numeric values quoted in the json object?
--
Mark Wieder
ahsoftw...@gmail.com
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode