We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Reading JSON file matrix

Home Forums General Questions Reading JSON file matrix

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #84308
    jelteh
    Participant

    Goodday reader,

    I am currently working on a function in Puzzles to read out a JSON file, and output the correct number. But somehow I can’t seem to read it out properly. It is a nested JSON, and I’ll put it in the attachement of this post, along with my Puzzles structure. Could somebody help me figure out how to read these values out?

    Thanks in advance!

    #84311
    jelteh
    Participant

    It has come to my attention that I should probably use “create list” instead of “create text” puzzles. It shows up correctly in the console now when I print, but it can’t yet read out the JSON file for some reason.

    #84316
    QiangGe
    Participant

    but it can’t yet read out the JSON file for some reason.

    Can you upload this JSON file

    #84319
    Roel
    Customer

    Good morning!

    I made a quick example for you with logging and puzzles basics.
    This is one of the ways to get the information from a nested json.

    Depending on what u want/need u can rebuild this to fit your needs.

    #84323
    jelteh
    Participant

    Goodmorning, thanks for the replies.
    I am still unable to read it out. I’ll put the code in down below.
    The thing is that I need the keys to be flexible. When the user selects a certain size (both width and height), it should automatically use the JSON as a look-up table and get the proper value. That’s the context for this file, and that is why I’ve ordered it this way.

    Json file

    When I print the loaded data and in dict get key they do show up. But when I try to get to a key within the key, it seems not to work. Some additional information would be appreciated :) Thanks in advance

    #84324
    jelteh
    Participant

    This is what I recreated btw, but I cannot get it to give me a key within a key…

    Puzzles

    • This reply was modified 3 months, 1 week ago by jelteh.
    #84330
    Roel
    Customer

    This shows how to get the key in a parent object.
    From that u we print the value.

    But for your needs i think u have to make it a bit more dynamic.
    If u have more questions please feel free to email me on r.adriaans@cpqfactory.com

    Attachments:
    #84332
    QiangGe
    Participant

    Some additional information

    The logic might not be perfect. We can test it out.

    Attachments:
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.