[ SOLVED ] Creating two JSON structures using Json Generator

Ralph Parkhurst

Member
Licensed User
Longtime User
I need code written that creates the following two JSON structures using Json Generator in B4J.

Happy to pay a reasonable amount via Paypal to anyone that can do this quickly.

Sample 1:
{
  "INSTRUCTIONS": [
    {
      "NAME": "Female Arabic",
      "AUDIO_FILE": "Female Arabic.wav",
      "LANGUAGE": "ara",
      "AUTHORITY": "TEST1"
    },
    {
      "NAME": "Female English",
      "AUDIO_FILE": "Female English.wav",
      "LANGUAGE": "eng",
      "AUTHORITY": "TEST2"
    },
    {
      "NAME": "Female Urdu",
      "AUDIO_FILE": "Female Urdu.wav",
      "LANGUAGE": "urd",
      "AUTHORITY": "TEST3"
    }
  ],
  "CONTROL": [
    {
      "TRIGGER": "Button1",
      "INSTRUCTION_LIST": [
        "Female Arabic",
        "Female English",
        "Female Urdu"
      ],
      "DURATION": 0,
      "MESSAGE_BREAK_MINIMUM_SPEED": 0,
      "MESSAGE_BREAK_DURATION": 0,
      "C_MODE_HYSTERESIS": 0
    }
  ],
  "LANGUAGE": "ara",
  "CFG_VERSION": "V1.09"
}

Sample 2:
{
  "CHANNELS": {
    "INCLUDE": [
      {
        "FREQUENCY": 88000,
        "LANGUAGE": "ara",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 1
      },
      {
        "FREQUENCY": 89600,
        "LANGUAGE": "urd",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 0
      },
      {
        "FREQUENCY": 89900,
        "LANGUAGE": "urd",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 0
      },
      {
        "FREQUENCY": 90600,
        "LANGUAGE": "ara",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 1
      },
      {
        "FREQUENCY": 90800,
        "LANGUAGE": "ara",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 1
      },
      {
        "FREQUENCY": 92400,
        "LANGUAGE": "ara",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 1
      },
      {
        "FREQUENCY": 93400,
        "LANGUAGE": "ara",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 1
      },
      {
        "FREQUENCY": 94100,
        "LANGUAGE": "ara",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 1
      },
      {
        "FREQUENCY": 97300,
        "LANGUAGE": "ara",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 1
      },
      {
        "FREQUENCY": 97500,
        "LANGUAGE": "eng",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 0
      },
      {
        "FREQUENCY": 98000,
        "LANGUAGE": "ara",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 1
      },
      {
        "FREQUENCY": 99800,
        "LANGUAGE": "ara",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 1
      },
      {
        "FREQUENCY": 105500,
        "LANGUAGE": "eng",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 0
      },
      {
        "FREQUENCY": 106000,
        "LANGUAGE": "ara",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 1
      },
      {
        "FREQUENCY": 107300,
        "LANGUAGE": "ara",
        "LEVEL": 20,
        "AUTO_LEVEL": "NO",
        "POPULAR": "NO",
        "TA": 1
      }
    ],
    "EXCLUDE": [],
    "AUTOMATIC": {
      "ACTIVE": "NO",
      "LEVEL": 100,
      "AUTO_LEVEL": "NO"
    },
    "ENHANCED": {
      "ACTIVE": "NO",
      "REPEAT": 1
    }
  },
  "CFG_VERSION": "V1.09"
}

If you can do this, please reply with your charge. I should add I don't need a complete program - just a block of code (with all the necessary map and list definitions) that will create these two JSON samples.

Many thanks,
Ralph Parkhurst
 

cklester

Well-Known Member
Licensed User
It's very easy. Attached will get you started... Just ask if you have questions about it.

A more complicated process will be to read the data from somewhere and add it to the map/JSON, but that's also not complicated.
 

Attachments

  • Project.zip
    8.7 KB · Views: 198
Top