calling an api from a stack?
bonnmike at gmail.com
Fri Jun 15 13:40:55 EDT 2018
jsontoarray returns an array, you'll have to dig through the array to find
where pieces of information reside, but it pretty straightforward after you
For example.. If you instead do this..
put jsontoarray(tResult) into tArray
you have an array variable named tArray.
If you-- put the keys of tArray you'll see the first level of keys.
One of the keys is named "text" and it has a numeric subkey named 1
So if you-- put tArray["text"] into field 1
The translation will be placed into the field.
YOu can use the "put the keys" syntax to find subkeys too, so if you-- put
the keys of tArray["text"] you get back the single subkey 1. If you were
to-- put the keys of tArray["text"] you would get nothing back because
there are no subkeys. Instead, a value has been placed into key
["text"] which is your translated text. Its pretty easy to poke around
an array this way and figure things out, especially since the array for
this is pretty simple. (also look at "elements" in the dictionary)
On Fri, Jun 15, 2018 at 11:07 AM Eric A. Engle via use-livecode <
use-livecode at lists.runrev.com> wrote:
> This works, sort of:
> put URL "
> into tResult
> put tResult into card field 1
> --put JsonImport(tResult) into tResults
> --put JsonToArray(tResults) into tProfile
> put tResult & return into cd fld 1
> set the itemdelimiter to "["
> put the last item of tResult after cd fld 1
> for some reason JsonImport and JsonToArray return nothing. I can however
> set delimiter to [ and then programmatically delete the first and last 3
> chars after the last item of tResult. But why can't, or how, must I extract
> from Json?
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the Use-livecode