[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading JSON file from IFS



Ron,

This question doesn't appear to be related to HTTTPAPI, FTPAPI or WSDL2RPG. Please move it to a different list/forum? This one is for those three projects only.

Your example makes no sense, anyway. Your JSON does not have a field named 'success', so what do you expect will happen when you try to read one from the document?

-SK

On 11/2/2016 1:32 PM, Ron Koontz wrote:
    Hello,

    I'm trying to read a json file and I'm not getting the data to load I
    don't think.

    In the example I'm using the 1^st read json example from the website.

    I'm using this url to get some json test data :
    [1]http://headers.jsontest.com/

    I used one of my other programs that exports the XML to get this data
    and saved it to a .json type.

    Data looks like this:

    {

       "X-Cloud-Trace-Context":
    "d16c514c3b1cc6cc3758a3b41f958f4d/17804618137577403361",

       "Host":
    "headers.jsontest.com",

       "User-Agent":
    "http-api/1.23"

    }


    I have a JSON file in our IFS called example.json.  Simple yes.


    Inside the RPG pgm I have:


    docNode = yajl_stmf_load_tree( '/tmp/example.json' : errMsg );

    if errMsg <> '';

        // handle error

     endif;


     node = YAJL_object_find(docNode: 'success');

     result.success = YAJL_is_true(node);



    There is nothing in the errMsg however the result.success is `0'.  So
    its like its not loading or something.   Any ideas out there?


    Just trying to get it to work before I go hog wild on something.


    Thanks

    Ron

      __________________________________________________________________

    The information contained in this e-mail is intended only for the
    individual or entity to whom it is addressed. Its contents (including
    any attachments) may contain confidential and/or privileged
    information. If you are not an intended recipient you shall not use,
    disclose, disseminate, copy or print its contents. If you receive this
    e-mail in error, please notify the sender by reply e-mail and delete
    and destroy the message. Continental Express, Inc. and its subsidiaries
    and affiliates will not be held liable for the unintended or
    unauthorized use of any information contained in this email or as a
    result of any additions or deletions of information originally
    contained in this email.

References

    1. http://headers.jsontest.com/



-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------