Skip to Main Content
The Adabas & Natural Ideas Portal does not contain ideas from products ApplinX and EntireX. Please refer to the IBM Ideas Portal for these products (IBMid required).
Status Released
Categories Natural (NAT)
Created by Hezi Shirazi
Created on Jul 15, 2021

Add support form Json format such as Xml

Hello,

I need a support for Json format such as Xml format (Xml toolkit)

Use Case Seriliazse Josn format in Natural modules
Created on Brainstorm 04/02/2019 23:57
Brainstorm ID 6904
  • Jose De Vogelaere
    Nov 25, 2025

    WinDev provides native JSON features via:

    1. WLanguage JSON Functions (Classic procedural code)

    These functions allow you to:

    • Create JSON (JSONBuild)

    • Parse JSON (JSONToVariant, JSONToString)

    • Navigate JSON structures via variants or associative arrays

    • Serialize/deserialize objects

    2. JSON Variables (Native JSON type)

    WinDev has a json type that behaves like a structured object.

    Example:

    myJson is json
    myJson.name = "Alex"
    myJson.age = 30

    3. Mapping JSON to Classes / Structures

    You can easily bind:

    • JSON → Class (Deserialize)

    • Class → JSON (Serialize)

    4. REST Integration

    WinDev REST functions (HTTPRequest, RESTSend, etc.) commonly work with JSON responses.


    📌 Basic Examples

    Example 1 — Parse JSON using Variant

    sData is string = [
    {
    "name": "Alice",
    "age": 32,
    "languages": ["EN", "FR"]
    }
    ]

    jsonVariant = JSONToVariant(sData)

    Info(jsonVariant[1].name) // "Alice"
    Info(jsonVariant[1].languages[2]) // "FR"


    Example 2 — Build JSON Manually (JSONBuild)

    arrLanguages is array of string
    arrLanguages.add("EN")
    arrLanguages.add("FR")

    sJSON is string
    sJSON = JSONBuild(
    [
    "name" : "Alice",
    "age" : 32,
    "languages" : arrLanguages
    ]
    )

    Info(sJSON)

    Result:

    {"name":"Alice","age":32,"languages":["EN","FR"]}


    Example 3 — Using the json Type

    The json type acts like a dynamic object.

    person is json
    person.name = "Bob"
    person.age = 45
    person.active = True

    // Add an array
    person.hobbies = []
    person.hobbies[1] = "Running"
    person.hobbies[2] = "Skiing"

    Info(JSONToString(person))


    Example 4 — Deserialize JSON into a Class

    Class:

    // Class Person
    name is string
    age is int
    active is boolean

    Code:

    sJSON is string = {"name":"John","age":40,"active":true}

    myPerson is Person
    Deserialize(myPerson, sJSON, psJSON)

    Info(myPerson.name) // John


    Example 5 — Serialize a Class into JSON

    myPerson is Person
    myPerson.name = "Emma"
    myPerson.age = 27
    myPerson.active = True

    sOut is string = Serialize(myPerson, psJSON)

    Info(sOut)


    Example 6 — Calling a REST API and Reading JSON

    HTTPRequest("https://jsonplaceholder.typicode.com/todos/1")

    IF HTTPGetResult(httpResult) THEN
    sResponse is string = HTTPGetResult(httpResult)
    todo = JSONToVariant(sResponse)
    Info(todo.title)
    END


    👉 Summary

    Feature

    Supported?

    Notes

    Parse JSON

    JSONToVariant, json type

    Build JSON

    JSONBuild, json type

    Serialize Class → JSON

    Serialize(..., psJSON)

    Deserialize JSON → Class

    Deserialize(..., psJSON)

    REST with JSON

    HTTPRequest, RESTSend


    If you want, I can also provide:

    • A full CRUD example using JSON + HFSQL

    • A REST client project template (WinDev UI + JSON)

    • Comparison of the three different JSON approaches in WinDev

    Just tell me!


  • Mike Putzig
    Mar 28, 2024

    Please also for mainframe z/OS

  • Sagi Achituv
    Dec 27, 2022

    I would suggest to add also a parsing Json messages, as XML is parsed with the PARSE XML statement (or extend the PARSE XML to include PARSE JSON , as an option

  • Admin
    Eli Cohen
    Jun 20, 2022

    It is still under review.

  • Hezi Shirazi
    May 11, 2022

    Hello,


    I would to know if there is any progress in that issue.

    Maybe a plan schedule or other?

  • +2
1 MERGED

Parse Json format file as Xml do

Merged
Today, we can parse a file (work-file) written in XML format. But, we cant parse a file in Json format (while it is the most common format to tranfer data today)
Hezi Shirazi almost 3 years ago in Natural for Linux and Cloud / Natural (NAT) 1 Released