Import json/html code

Hello everybody, i need help on appinventor, i want to import a text with json “0000/1111 - 22%” but i have only “0000” after import and when i want to import 0000-1111 - 22%" i have only “0000-1111”. What can i do ?

Hello @turriert,

When you say you are trying to import the text “0000/1111 - 22%” as JSON, is the string actually wrapped in quotes? That’s not valid JSON, so the behavior is likely to be undefined exactly what gets returned. For example, this should do what you want:

blocks (30)

Note: Make sure that the double quotes are actually double quotes and not stylized quotes that Apple et al. make your device produce. The former are part of the JSON spec and the latter are just going to cause you problems.

Hello @ewpatton,
I have this page from http with a php code :
capture page http

i have this on my php code :
printf(“ultra : %d/%d - %01.1f%%”,mysqli_num_rows($retrait_ultra),mysqli_num_rows($inscrits_ultra),$statsUltra);
print(’
’);

Okay, but this is not JSON…? I would expect something more like this if you want to parse it using the Web.JsonTextDecode block:

{
  "ultra": "1/867 - 0.1%",
  "explore": "0/40 - 0.0%",
  ...
}

Is it your php code ? If so, you can create a json array in the php for your result…

now i have this :
{“ultra”:“1-867 - 0.11534025374856%”,“explore”:“0-40 - 0%”,“first”:“0-38 - 0%”,“rando”:“0-9 - 0%”,“enduro”:“0-23 - 0%”,“kids”:“0-10 - 0%”,“draisienne”:“0-8 - 0%”}

with this code on my appinventor :

If your “json” is actually coming in as you posted, with “enhanced double quotes” you will need to first convert them to standard double quotes. Then you can use the decode from the web component to convert the key pairs to a list of lists - appinventor style. To get the first value of the two in each split at spaces after selecting each one. ( used a | as a separator for display purposes, so as to not confuse with the “:” in the json :slight_smile:
Example aia project attached
jsonresolve.aia (3.5 KB)

Why are you setting tempData to both the result of Web1.JsonTextDecode and Web1.HtmlTextDecode? The call to the latter will overwrite the result of the former.

Hello @ewpatton and @TIMAI2,
it’s good my app is ok.
Thank you very much for your help, i have delete HtmlTextDecode.