ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

YAJL Array Elements - 0,1,2, or 1,2,3

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

  • YAJL Array Elements - 0,1,2, or 1,2,3

    If I want to access the first element of a JSON array using Scott Klement's YAJL port from RPG, does YAJL index the array from 0, 1, 2... or from 1, 2, 3... ?

    In other words, for example, if I want to use yajl_array_elem (or yajl_object_elem for the first item in a JSON object) to get the first element, do I use index 0, or index 1?

    I can't really find a clear answer to this.

  • #2
    In both yajl_array_elem and yajl_object_elem, the index starts at 1. Zero will return *NULL, as if the object you asked for isn't found.

    Comment

    Working...
    X