Results 1 to 10 of 40

Thread: YAFR DataTypeToJson beyond 19.1

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #40
    Join Date
    Mar 2009
    Location
    Adelaide, South Australia
    Posts
    381

    Default Re: YAFR DataTypeToJson beyond 19.1

    Interesting as it is, I can't help feeling that this topic has got a bit off track. The original post was asking for extra capability in exchanging data between Json and DF structs. Well Json is generally derived from a javascript array structire of Name/Value pairs and presents to DF as an ASCII string of delimited Name/Value pairs. So, only those values which can be supported by ASCII can be in that string. NULL is supported by the control character \0 (zero) which is available in DF as (Character(0)). Other concepts of NULL such as "undefined/not yet defined" are not supported in ASCII so cannot be included in Json unless by agreement between the sender and receiver to nominate an otherwise unused ASCII character for that purpose. Not that I can see why you would want undefined data.

    NULL is no use in DF unless the programmer uses it to carry out some action. In my opinion the best way to handle the issue and achieve all this post wants (and more) is to convert Json into an appropriate struct of Name/Value pairs and thence post to the struct you require with appropriate processing. Or, you could simply use the NVP struct in your code.

    Struct NVP
    String Name
    String Value
    End_Struct

    Struct NVP2
    String Name
    NVP2[] Values
    End Struct

    If you want a simple "single-dimension" Struct you can use NVP[] as the intermediary.
    For more complex Structs you could use NVP2[] (I think). I've never needed to do this but if my NVP2 isn't right I'm sure you can work it out so that you exactly mirror the original javascript array.

    Now you can pass exactly what you want out to the external web-service and make whatever decisions you need about the data which comes back,which of course, doesn't need all the elements of the final struct, without setting any properties.

    Ian
    Last edited by Ianv; 19-Apr-2019 at 09:00 PM.
    The most important leg on a three legged stool is the one that's missing.
    Murphy's Law (2)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •