JW_ARR

Table of Contents

JW_ARR

Description

Write a JSON array from a vector. Each item is rendered using the provided writer. Handles inserting commas between elements.

Parameters

NameDirectionDescription
jin,outThe target string to append to.
arrinA vector to iterate over.
itemoutIterator variable for the current item.
writerinCode block that appends JSON for each item.

Usage example (from documentation)

  JW_ARR(json, some_vec, s, {
      JW_STR(json, s);
  });

Success

Appends a JSON array to json

Failure

Does not return on failure

Usage example (Cross-references)

    }                                                                                                              \
    StrAppendf(&(j), "\"%s\":", k);                                                                                \
    JW_ARR(j, arr, item, writer);                                                                                  \
    } while (0)

Share :

Related Posts

JR_ARR_KV

JR_ARR_KV Description Conditionally parse a JSON array if key matches expected name.

Read More

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.

Read More

JR_OBJ_KV

JR_OBJ_KV Description Conditionally parse a JSON object if key matches expected name.

Read More