Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
Loading...
Searching...
No Matches
yyjson_mut_obj_iter Struct Reference

#include <yyjson.h>

Data Fields

size_t idx
size_t max
yyjson_mut_valcur
yyjson_mut_valpre
yyjson_mut_valobj

Detailed Description

A mutable JSON object iterator.

Warning
You should not modify the object while iterating over it, but you can use yyjson_mut_obj_iter_remove() to remove current value.

Example

yyjson_mut_val *key, *val;
while ((key = yyjson_mut_obj_iter_next(&iter))) {
your_func(key, val);
if (your_val_is_unused(key, val)) {
}
}
yyjson_mut_val * obj
Definition yyjson.h:3748
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_next(yyjson_mut_obj_iter *iter)
Definition yyjson.h:7020
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_remove(yyjson_mut_obj_iter *iter)
Definition yyjson.h:7037
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_get_val(yyjson_mut_val *key)
Definition yyjson.h:7032
yyjson_api_inline yyjson_mut_obj_iter yyjson_mut_obj_iter_with(yyjson_mut_val *obj)
Definition yyjson.h:7009

If the ordering of the keys is known at compile-time, you can use this method to speed up value lookups:

// {"k1":1, "k2": 3, "k3": 3}
yyjson_mut_val *key, *val;
yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_get(yyjson_mut_obj_iter *iter, const char *key)
Definition yyjson.h:7054
See also
yyjson_mut_obj_iter_get() and yyjson_mut_obj_iter_getn()

Definition at line 3743 of file yyjson.h.

Field Documentation

◆ cur

yyjson_mut_val* yyjson_mut_obj_iter::cur

current key

Definition at line 3746 of file yyjson.h.

◆ idx

size_t yyjson_mut_obj_iter::idx

next key's index

Definition at line 3744 of file yyjson.h.

◆ max

size_t yyjson_mut_obj_iter::max

maximum key index (obj.size)

Definition at line 3745 of file yyjson.h.

◆ obj

yyjson_mut_val* yyjson_mut_obj_iter::obj

the object being iterated

Definition at line 3748 of file yyjson.h.

◆ pre

yyjson_mut_val* yyjson_mut_obj_iter::pre

previous key

Definition at line 3747 of file yyjson.h.


The documentation for this struct was generated from the following file: