Why is this asjson not working

Discussion and feedback on Construct 2

Post » Fri Aug 01, 2014 6:45 pm

I'm trying to set a list and another text box from a dictionary by using the st from json action with the expression dictionary.asjson but none of them seems to respond
You do not have the required permissions to view the files attached to this post.
B
15
S
4
Posts: 138
Reputation: 2,003

Post » Sun Aug 03, 2014 10:01 am

Dasat wrote:I'm trying to set a list and another text box from a dictionary by using the st from json action with the expression dictionary.asjson but none of them seems to respond


The way your using .asjson wont work.

When you try and load a text box with .asjson, the text box is looking for the text box format json. As you are trying to load a 'dictionary json format", the text box will not recognize it.

If you want to insert raw dictionary data, then go textbox.settext > "" & dictionary.asjson.

If you want to get sequential values from the dictionary, then i highly suggest using an array.

But it can be done with dictionary.

One way is to use numbered keys, i.e. key: "0"="bob" key: "1" = "sam" etc etc.

Now we create a for loop.

For i = 0 to 9
Textbox.appendtext "" & dictionary.get(system.loopindex("i") & "") & newline // Here we convert the numbered loopindex into a string so we can address the dictionary key to get the data.

I hope this helps. :)
You do not have the required permissions to view the files attached to this post.
B
10
S
2
G
1
Posts: 92
Reputation: 926

Post » Sun Aug 03, 2014 5:42 pm

@tomsstudio, thanks a lot
tomsstudio wrote:
Dasat wrote:I'm trying to set a list and another text box from a dictionary by using the st from json action with the expression dictionary.asjson but none of them seems to respond


The way your using .asjson wont work.

When you try and load a text box with .asjson, the text box is looking for the text box format json. As you are trying to load a 'dictionary json format", the text box will not recognize it.

If you want to insert raw dictionary data, then go textbox.settext > "" & dictionary.asjson.

If you want to get sequential values from the dictionary, then i highly suggest using an array.

But it can be done with dictionary.

One way is to use numbered keys, i.e. key: "0"="bob" key: "1" = "sam" etc etc.

Now we create a for loop.

For i = 0 to 9
Textbox.appendtext "" & dictionary.get(system.loopindex("i") & "") & newline // Here we convert the numbered loopindex into a string so we can address the dictionary key to get the data.

I hope this helps. :)
B
15
S
4
Posts: 138
Reputation: 2,003


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests