REXYGEN Community Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Login

    JSON string parsing issue

    REXYGEN Studio
    2
    2
    276
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Mkrupicka
      last edited by

      Hello all in REXYGEN!

      I have issue with parsing JSON object through PJSOCT block.
      The input to the PJSOCT block is string, the output is also suppost to be a string but it is somehow interpretted as number and moreover represented in exp format. This destroyes long integer variables that I receive from communication partner and need to process in REXYGEN executive.

      In the enclosed example a simple JSON object is parsed with integer id parameter:

      {
         "status":"success",
         "id": 456877932143130020
      }
      

      but PJSOCT outputs the id parameter as 4.5687793214313e+17

      PJSOCT problem.png

      Could you help, please?

      Thanks and Regards,
      Michal

      cechuratC 1 Reply Last reply Reply Quote 0
      • cechuratC
        cechurat @Mkrupicka
        last edited by

        @mkrupicka Hello Michal,

        thank you for your post. You are right - the behaviour of PJSOCT function block is not as one would expect. However it is also caused by format of "id" item - since the value is written without quotation marks it represents number by the definition.

        I would use different approach:

        • search the string for substring "id"
        • offset the position (I presume that the message structure is given)
        • extract substring (I presume that the ID length is given)

        cfc11698-ac5b-4527-bb9a-989303ca4380-image.png

        If you need any help just let me know.

        Kind regards,
        Tomas

        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        This is a community forum for REXYGEN users and fans. Detailed information can be found at REXYGEN homepage.

        There is also an outdated REXYGEN community forum.

        Powered by NodeBB.