Ad Widget

Collapse

Help needed for parsing JSON

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SofCave
    Junior Member
    • Nov 2021
    • 1

    #1

    Help needed for parsing JSON

    I have a Discovery rules that returns, for example, A and B.
    Then I have a Item prototypes that executes a script with the discovered values, Ex.: script.sh "A".
    This script returns the following JSON:
    Code:
    {
        "DATA1": {
            "A": 19,
            "B": 97,
            "C": 100
        },
        "DATA2": {
            "X": 9,
            "Y": 9,
            "Z": 1
        }
    }
    "DATA1", "DATA2" are fixed keys.
    "A", "B", "C" can vary depending on the targeted server?

    Now I want to have an item like DATA1[A] = 19

    I don't know how to retrieve "A", "B" and "C" and their values.


    Thanks for the help
Working...