Why is this asjson not working

0 favourites
  • 3 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • 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

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • tomsstudio, thanks a lot

    > 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)