On 22/01/2017 03:22, J. Landman Gay via use-livecode wrote:
Here's a test sample of some UTF8 I get back from a server:

  {"UserID":48,"UserName":"Eduardo Ba\u00f1uls","UserLoginName":"ebanu"}

Hi Jacque,

This is valid JSON (and also valid ASCII). In JSON, any character in a string may be encoded in the form \uXXXX where XXXX is the 4-digit hexadecimal representation of a Unicode codepoint. No textDecode() operation is required.

JSONImport() handles this correctly.

1) Create a stack with a field and a button
2) Put the text above into the field
3) Set the script of the button to:

> local tJson
> put JSONImport(field 1) into tJson
> answer tJson["UserName"]

4) Enter browse mode and click the button

You will get an answer dialog displaying "Eduardo BaƱuls".

                            Peter

--
Dr Peter Brett <peter.br...@livecode.com>
LiveCode Technical Project Manager

lcb-mode for Emacs: https://github.com/peter-b/lcb-mode

_______________________________________________
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

Reply via email to