JW_STR
- Macro
- August 22, 2025
Table of Contents
JW_STR
JW_STR
Description
Append a string value (quoted) to the JSON.
Parameters
Name | Direction | Description |
---|---|---|
j | in,out | The target string to append to. |
s | in | A Str object containing the string. |
Usage example (from documentation)
JW_STR(json, name);
Success
Appends a quoted string to json
Failure
Does not return on failure
Usage example (Cross-references)
- In
JSON.h:909
:
} \
StrAppendf(&(j), "\"%s\":", k); \
JW_STR(j, s); \
} while (0)
VecPushBack(&languages, lang3);
JW_OBJ(json, { JW_ARR_KV(json, "languages", languages, lang, { JW_STR(json, lang); }); });
const char* expected = "{\"languages\":[\"C\",\"Python\",\"Rust\"]}";
JW_STR_KV(json, "name", product.name);
JW_FLT_KV(json, "price", product.price);
JW_ARR_KV(json, "tags", product.tags, tag, { JW_STR(json, tag); });
});
JW_OBJ(json, {
JW_ARR_KV(json, "numbers", empty_numbers, num, { JW_INT(json, num); });
JW_ARR_KV(json, "strings", empty_strings, str, { JW_STR(json, str); });
});
JW_INT_KV(json, "analysis_id", result.analysis_id);
JW_STR_KV(json, "sha256", result.sha256);
JW_ARR_KV(json, "tags", result.tags, tag, { JW_STR(json, tag); });
JW_STR_KV(json, "created_at", result.created_at);
JW_INT_KV(json, "model_id", result.model_id);
JW_OBJ(json, {
JW_ARR_KV(json, "numbers", numbers, num, { JW_INT(json, num); });
JW_ARR_KV(json, "strings", strings, str, { JW_STR(json, str); });
JW_ARR_KV(json, "booleans", booleans, b, { JW_BOOL(json, b); });
});
- In
RoundTrip.c:376
:
JW_OBJ(json, {
JW_ARR_KV(json, "numbers", original_numbers, num, { JW_INT(json, num); });
JW_ARR_KV(json, "strings", original_strings, str, { JW_STR(json, str); });
});
- In
RoundTrip.c:550
:
JW_INT_KV(json, "timeout", original.config.timeout);
JW_STR_KV(json, "log_level", original.config.log_level);
JW_ARR_KV(json, "features", original.config.features, feature, { JW_STR(json, feature); });
});
JW_ARR_KV(json, "numbers", original.numbers, num, { JW_INT(json, num); });
- In
RoundTrip.c:657
:
JW_STR_KV(json, "empty_string", empty_str);
JW_ARR_KV(json, "empty_numbers", empty_numbers, num, { JW_INT(json, num); });
JW_ARR_KV(json, "empty_strings", empty_strings, str, { JW_STR(json, str); });
JW_OBJ_KV(
json,