You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JSON arrays can't hold key-value pairs, just values. Requiring JSONPair_t when iterating arrays unnecessarily complicates user code. IMO there should be separate APIs for iterating arrays, and iterating collections -- can likely reuse existing implementation under the hood. Doing so would make user's code easier to read, as it'd be obvious where arrays are being iterated vs. non-arrays.
It should only require one 'index' parameter for Iterating vs. having 2 separate parameters for start and next. The function is already modifying these index parameters, so why can't it just have one pulIndex where its value at entry serves as start, and the value of next is written back to pulIndex before returning?
Would be nice for JSON_Iterate:
A parameter for specifying which array index, not index within buffer, would be nice if for example I only wanted to Iterate array[middle:end]. Sure, technically this is possible with current start and end parameters, however these are with respect to the buffer index. A user could call a JSON_Search("array[i]", ...) and do char * delta to compute an index, but that seems roundabout and sort of "hacky" vs. having this API honor some "array-index" parameter.
Support for reverse array traversal. It's not uncommon for JSON arrays to be sorted. For example, I might have an array of objects sorted by creation time, and I might want to traverse from oldest-to-youngest or vice versa for different scenarios, or traverse backwards if my array is large and I know I want something closer to the end.
The text was updated successfully, but these errors were encountered:
Two gripes regarding
JSON_Iterate
JSON arrays can't hold key-value pairs, just values. Requiring
JSONPair_t
when iterating arrays unnecessarily complicates user code. IMO there should be separate APIs for iterating arrays, and iterating collections -- can likely reuse existing implementation under the hood. Doing so would make user's code easier to read, as it'd be obvious where arrays are being iterated vs. non-arrays.It should only require one 'index' parameter for Iterating vs. having 2 separate parameters for start and next. The function is already modifying these index parameters, so why can't it just have one
pulIndex
where its value at entry serves asstart
, and the value ofnext
is written back topulIndex
before returning?Would be nice for
JSON_Iterate
:start
andend
parameters, however these are with respect to the buffer index. A user could call aJSON_Search("array[i]", ...)
and dochar *
delta to compute an index, but that seems roundabout and sort of "hacky" vs. having this API honor some "array-index" parameter.The text was updated successfully, but these errors were encountered: