ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

YAJL Error : lexical error: invalid character inside string

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • YAJL Error : lexical error: invalid character inside string

    Hi
    some time i receive from an app, json document that contains "strange" character (see attached image) ;
    the json document , that i try to read , is stored in IFS with CCSID 1208
    how can i solve/monitor this problem so that i can read the document ?
    Thanks in advance

    when my program execute
    yajllist = YAJL_object_find(yajlNode: 'MyJosnDoc' );
    receive the error "lexical error: invalid character inside string"




    Attached Files

  • #2
    What is this character meant to be? How do you know it's valid?

    Comment


    • #3
      Hi Scott
      thanks for your reply

      The APP that run under Android Get the city name via geolocation and then post it as Json file in Ibm i; i don't know what is the meant of this character , the really city name begin with "San .." . is it possible to ignore it when i run yajl procedure so i skip the error ? could i replace this character with blank , to avoid the error ?

      thanks in advance

      Comment


      • #4
        Its not possible to ignore the error in YAJL.

        You could scan/replace that character with a blank or remove it entirely before parsing the JSON. Personally, I'd consider that a kludge, and would only do so if I had no other alternative.

        Personally, I would find out where this character is coming from to begin with. Why is it there? And, then I'd try to fix the problem at its source. Is it due to a mis-translation of data? Is it due to an error earlier in the process? Then fix those things.

        Comment

        Working...
        X