Skip to content

JR_STR

JR_STR

Description

Read a JSON string value from stream and assign to target. The resulting string is dynamically allocated in Str format.

Parameters

Name Direction Description
si in,out JSON stream iterator to read from.
str out Destination Str to store the string.

Usage example (from documentation)

  JR_STR(si, name);

Success

str contains the read string

Failure

si updated to failure state on parse error

Usage example (Cross-references)

Usage examples (Cross-references)
                    JR_ARR_KV(json, "test_directories", {                                                                  \
                        Str s = StrInit();                                                                                 \
                        JR_STR(json, s);                                                                                   \
                        VecPushBack(&p.test_directories, s);                                                               \
                    });                                                                                                    \
                    JR_ARR_KV(json, "source_directories", {                                                                \
                        Str s = StrInit();                                                                                 \
                        JR_STR(json, s);                                                                                   \
                        VecPushBack(&p.source_directories, s);                                                             \
                    });                                                                                                    \
            JR_ARR_KV(si, "languages", {
                Str lang = StrInit();
                JR_STR(si, lang);
                VecPushBack(&languages, lang);
            });
            JR_ARR_KV(si, "tags", {
                Str tag = StrInit();
                JR_STR(si, tag);
                VecPushBack(&product.tags, tag);
            });
            JR_ARR_KV(si, "strings", {
                Str str = StrInit();
                JR_STR(si, str);
                VecPushBack(&parsed_strings, str);
            });
                JR_ARR_KV(si, "features", {
                    Str feature = StrInit();
                    JR_STR(si, feature);
                    VecPushBack(&parsed.config.features, feature);
                });
            JR_ARR_KV(si, "empty_strings", {
                Str str = StrInit();
                JR_STR(si, str);
                VecPushBack(&parsed_strings, str);
            });
            JR_ARR_KV(si2, "data", {
                Str value = StrInit();
                JR_STR(si2, value);
                VecPushBack(&data, value);
            });
Last updated on