Json file in WebStorage

Get help using Construct 2

Post » Wed Jul 29, 2015 5:42 pm

Hi,

I have a Json file built with a name's list of Excel.
The structure of my file is then:
{"c2dictionary":true,
data:{
"nom_01":NOM Prénom",
"nom_02":NOM Prénom",
...
}}

I would like to cherge this file to complete my WebStorage.
It would be necessary not to destroy the others datas of my WebStorage.

I try that:
Event ------------------------------------------ Action
Syst. On start of layout ------------------- Ajax Request liste.json (tag "a")
Ajax On "a" completed WebStorage -- Set local storage from JSON string AJAX.LastData
Mouse On any clic---------------------------Text1 Set text to AJAX.LastData
---------------------------------------------------Text2 Set text to WebStorage.AsJSON

The text1 show realy the good list of names, but not the text2 wiich say me that the data charged is empty: ({"c2dictionary":true,"data":{}})

How to do ?
Thanks
B
10
S
3
Posts: 82
Reputation: 830

Post » Wed Jul 29, 2015 7:02 pm

B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Thu Jul 30, 2015 8:26 am

Thank's Korbaach,

but all my appli is built with Webstorage ! and it would be a very big work all to rebuild. My next appli do...

Do you see why my text2 don't show my Json?
B
10
S
3
Posts: 82
Reputation: 830

Post » Tue Aug 04, 2015 10:27 am

hi !

i can now charged a json file with Ajax and then open it in my webstorage (my old file had a syntax error)

but i can't open directly the json file in the webstorage withe this line:

on start of layout..........Webstorage Set Local Storage from Json string "monfichier.txt"

is it normal ?
B
10
S
3
Posts: 82
Reputation: 830


Return to How do I....?

Who is online

Users browsing this forum: Bioniclekolacz and 7 guests