Skip to content

JR_ARR

JR_ARR

Description

Read a JSON array using a custom value reader expression.

The macro parses a JSON array and calls the user-provided code block for each element. If the value can’t be parsed or reader fails to advance the iterator, the value is skipped.

Parameters

Name Direction Description
si in,out Stream iterator to read from.

Usage example (from documentation)

  JR_ARR(si, {
      MyStruct tmp = {0};
      JR_OBJ(si, {
          JR_INT_KV(si, "x", tmp.x);
          JR_FLT_KV(si, "y", tmp.y);
      });
      VecPush(&data.items, tmp);
  });

Success

All values processed or skipped gracefully

Failure

Logs error and restores si on structural or read failure

Usage example (Cross-references)

Usage examples (Cross-references)
        do {                                                                                                               \
            if (!StrCmpZstr(&key, (k))) {                                                                                  \
                JR_ARR(si, reader);                                                                                        \
            }                                                                                                              \
        } while (0)
Last updated on