ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

YAJL and Boolenn

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

  • YAJL and Boolenn

    Good Day,

    I have a JSON data coming in and one is a Boolean value ( true/false)

    I was expecting there to be a read like:

    d field s n

    node = yajl_object_find( docnode : Bollean_Field)
    Field = yajl_get_bool( node )

    But I do not see it with in the copy source of yajl.

    I am using :
    node = yajl_object_find( docnode : Bollean_Feild)
    Field = yajl_get_string( node )

    and not getting the proper value true or false value ( *On or *Off )

    Perhaps someone can set me straight on this.

    Thnx
    Bill
    Bill
    "A good friend will bail you out of jail,
    A true friend would be sitting beside you saying,
    'Wow, that was fun.'"

  • #2
    I have found it:

    node = yajl_object_find( docnode : Bollean_Field);
    Field = isTrue( Node );

    d isTrue b
    d isTrue pi n
    d node s Like( yajl_val )

    If yajl_is_true(node);
    return *on;
    Endif;
    Return *off;

    d isTrue e

    Bill
    "A good friend will bail you out of jail,
    A true friend would be sitting beside you saying,
    'Wow, that was fun.'"

    Comment


    • #3
      Yes. there are yajl_is_true() amd yajl_is_false() routines that can be used to check the value of a boolean. yajl_is_true() does exactly the same thing that a "get bool" routine would've done, it returns true if the boolean variable was true, and false otherwise.

      Comment

      Working...
      X