[V12.34] Native JSON parser

SUGGESTED

Hello Everyone!

The V12.34 release notes describes the Native JSON parser:

Where can I find the JSON instructions documentation?

  • 0
    SUGGESTED

    Hello Juliano,

    We are also waiting for these new functions but it simply seems that they are not present in this latest 2023 R2 release.
    We could be wrong but the only functions that can be found in this 96.1.206 runtime seem to be:

    • jsonproto
    • escjson
    • unescjson

    For the rest, it does not seem to exist.
    Perhaps wait for possible official documentation from Sage, update of the runtime or the future 2024 release.

    In the meantime, you can still use our Toolbox X3's library of documented Json functions that many customers use every day.
    It's free and compatible V8 to V12.
    A quick demonstration is available on this page and uses functions allowing you to manipulate Json.
    It's probably less efficient than these future native functions but at least they exist.

    Anyway, have fun.

  • 0

    Hello! I opened ticket to Sage a few days ago because I needed the same information.

    They answer to me that the documentation is not available yet.

    They told me that it is a component that is prepared to have it expandable in 2024R1, and they have to make the documentation for these instructions.

  • 0 in reply to Myriam Romero Rua

    In the meantime, you can always create SQL views to parse inbound saved JSON data into something readable

  • 0 in reply to Myriam Romero Rua

    Same here, it seems that these new GRAPHQL Customization features are available but not really usable for now...

  • 0

    Hello, 
    There is still no information in the help despite the new release.
    Is anyone from Sage can give us any info ?

    Thanks

  • 0 in reply to SERVAES

    Despite the new release, it still seems that the native instructions for the Json are still not real... They still don't seem to be present in the runtime and even less so in the documentation.

    We are also still waiting for them.

  • 0
    SUGGESTED

    Hi everyone,
    I'm adding the response here as it is easier considering all side discussions.
    Yes new native JSON parsing 4GL functions are available since 2023R2 but:

    • The release note didn't updated the correct function names. This has already been flagged but it takes a bit of time to be changed.
    • The new online help refers to the new functions but examples are not good enough, so they will be updated
    • This is the premise, so the existing functions are not designed for JSON discovery/introspection, but rather consider that you know the nodes you are exploring.
      • The size of the JSON payload is limited, we have a request to allow bigger payloads. Size limit is not clear at the moment.
      • Eclipse doesn't recognize the functions yet, but it does compile don't worry

    Here is a snippet to help you:

    Local Clbfile SRCJSON
    SRCJSON =
    & '{"OBJECTTYPE":"MyObject","ACTX":null,"DIE":"","ENAFLG":true,"FLD1":[{"OBJECTTYPE":"MyObjectFDL1","ACTX":null,"FIETRC":"REQROOT"},{"OBJECTTYPE":"MyObject2FDL1","ACTX":null,"FIETRC":"REQFATHER"}]}'
    # Create the object
    Local Instance OBJ Using OBJECT
    Local Tinyint RETURN_STATUS
    
     # Parse the object
    PARSEINSTANCE OBJ With SRCJSON
     # Select the property
    Local Char MYSTR(30)
    
    MYSTR=OBJ.SELECT$("$.OBJECTTYPE")
    MYSTR=OBJ.SELECT$("$.FLD1[0].OBJECTTYPE")
    [L]MYSTR=OBJ.SELECT$("$.FLD1[1].FIETRC")
    [L]MYSTR=OBJ.SELECT$("$.FLD1")
    [L]MYSTR=OBJ.SELECT$("$.FLD1[0]")
    [L]MYSTR=OBJ.SELECT$("$.FLD1[1]")
    
    [L]RETURN_STATUS = OBJ.CONTAINS$("/FLD1")
    [L]RETURN_STATUS=OBJ.CONTAINS$("/FLD1/0/FIETRC")
    
    FreeGroup OBJ
    End

  • 0 in reply to Bruno Gonzalez

    Hi ! 

    I found this discussion that helped me create a processing to call a webservice.

    If I run the script manually, it works fine, however, if I run via a subscription, calling the PARSEINSTANCE function seems not to work, because the SELECT$ calls do not return any value.

    Are there any limitations related to calling the function via batch job?

    Thank you for your help.

    Nicolas.