114 const char *filename,
154 ecs_strbuf_t *buf_out);
184 ecs_strbuf_t *buf_out);
213 ecs_strbuf_t *buf_out);
230#define ECS_ENTITY_TO_JSON_INIT (ecs_entity_to_json_desc_t){\
231 .serialize_doc = false, \
232 .serialize_full_paths = true, \
233 .serialize_inherited = false, \
234 .serialize_values = true, \
235 .serialize_builtin = false, \
236 .serialize_type_info = false, \
237 .serialize_alerts = false, \
238 .serialize_refs = 0, \
239 .serialize_matches = false, \
270 ecs_strbuf_t *buf_out,
296#define ECS_ITER_TO_JSON_INIT (ecs_iter_to_json_desc_t){\
297 .serialize_entity_ids = false, \
298 .serialize_values = true, \
299 .serialize_builtin = false, \
300 .serialize_doc = false, \
301 .serialize_full_paths = true, \
302 .serialize_fields = true, \
303 .serialize_inherited = false, \
304 .serialize_table = false, \
305 .serialize_type_info = false, \
306 .serialize_field_info = false, \
307 .serialize_query_info = false, \
308 .serialize_query_plan = false, \
309 .serialize_query_profile = false, \
310 .dont_serialize_results = false, \
311 .serialize_alerts = false, \
312 .serialize_refs = false, \
313 .serialize_matches = false, \
338 ecs_strbuf_t *buf_out,
379 ecs_strbuf_t *buf_out,
FLECS_API const char * ecs_entity_from_json(ecs_world_t *world, ecs_entity_t entity, const char *json, const ecs_from_json_desc_t *desc)
Parse JSON object with multiple component values into entity.
struct ecs_entity_to_json_desc_t ecs_entity_to_json_desc_t
Used with ecs_iter_to_json().
FLECS_API const char * ecs_world_from_json(ecs_world_t *world, const char *json, const ecs_from_json_desc_t *desc)
Parse JSON object with multiple entities into the world.
struct ecs_from_json_desc_t ecs_from_json_desc_t
Used with ecs_ptr_from_json(), ecs_entity_from_json().
FLECS_API int ecs_type_info_to_json_buf(const ecs_world_t *world, ecs_entity_t type, ecs_strbuf_t *buf_out)
Serialize type info into JSON string buffer.
FLECS_API int ecs_iter_to_json_buf(ecs_iter_t *iter, ecs_strbuf_t *buf_out, const ecs_iter_to_json_desc_t *desc)
Serialize iterator into JSON string buffer.
struct ecs_world_to_json_desc_t ecs_world_to_json_desc_t
Used with ecs_iter_to_json().
FLECS_API int ecs_ptr_to_json_buf(const ecs_world_t *world, ecs_entity_t type, const void *data, ecs_strbuf_t *buf_out)
Serialize value into JSON string buffer.
struct ecs_iter_to_json_desc_t ecs_iter_to_json_desc_t
Used with ecs_iter_to_json().
FLECS_API const char * ecs_world_from_json_file(ecs_world_t *world, const char *filename, const ecs_from_json_desc_t *desc)
Same as ecs_world_from_json(), but loads JSON from file.
FLECS_API char * ecs_entity_to_json(const ecs_world_t *world, ecs_entity_t entity, const ecs_entity_to_json_desc_t *desc)
Serialize entity into JSON string.
FLECS_API char * ecs_ptr_to_json(const ecs_world_t *world, ecs_entity_t type, const void *data)
Serialize value into JSON string.
FLECS_API char * ecs_type_info_to_json(const ecs_world_t *world, ecs_entity_t type)
Serialize type info to JSON.
FLECS_API int ecs_world_to_json_buf(ecs_world_t *world, ecs_strbuf_t *buf_out, const ecs_world_to_json_desc_t *desc)
Serialize world into JSON string buffer.
FLECS_API char * ecs_world_to_json(ecs_world_t *world, const ecs_world_to_json_desc_t *desc)
Serialize world into JSON string.
FLECS_API char * ecs_iter_to_json(ecs_iter_t *iter, const ecs_iter_to_json_desc_t *desc)
Serialize iterator into JSON string.
FLECS_API const char * ecs_ptr_from_json(const ecs_world_t *world, ecs_entity_t type, void *ptr, const char *json, const ecs_from_json_desc_t *desc)
Parse JSON string into value.
FLECS_API int ecs_array_to_json_buf(const ecs_world_t *world, ecs_entity_t type, const void *data, int32_t count, ecs_strbuf_t *buf_out)
Serialize array into JSON string buffer.
FLECS_API char * ecs_array_to_json(const ecs_world_t *world, ecs_entity_t type, const void *data, int32_t count)
Serialize array into JSON string.
FLECS_API int ecs_entity_to_json_buf(const ecs_world_t *world, ecs_entity_t entity, ecs_strbuf_t *buf_out, const ecs_entity_to_json_desc_t *desc)
Serialize entity into JSON string buffer.
ecs_id_t ecs_entity_t
An entity identifier.
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
void ecs_poly_t
A poly object.
Used with ecs_iter_to_json().
bool serialize_values
Serialize component values.
bool serialize_builtin
Serialize builtin data as components (e.g.
bool serialize_alerts
Serialize active alerts for entity.
ecs_entity_t serialize_refs
Serialize references (incoming edges) for relationship.
bool serialize_matches
Serialize which queries entity matches with.
bool serialize_type_info
Serialize type info (requires serialize_values)
bool serialize_inherited
Serialize base components.
bool serialize_full_paths
Serialize full paths for tags, components and pairs.
bool serialize_entity_id
Serialize entity id.
bool serialize_doc
Serialize doc attributes.
Used with ecs_ptr_from_json(), ecs_entity_from_json().
const char * name
Name of expression (used for logging)
ecs_entity_t(* lookup_action)(const ecs_world_t *, const char *value, void *ctx)
Callback that allows for specifying a custom lookup function.
const char * expr
Full expression (used for logging)
bool strict
Require components to be registered with reflection data.
Used with ecs_iter_to_json().
bool serialize_full_paths
Serialize full paths for tags, components and pairs.
bool serialize_query_plan
Serialize query plan.
bool serialize_fields
Serialize field data.
bool serialize_doc
Serialize doc attributes.
bool serialize_query_profile
Profile query performance.
bool serialize_query_info
Serialize query terms.
bool dont_serialize_results
If true, query won't be evaluated.
bool serialize_field_info
Serialize metadata for fields returned by query.
bool serialize_builtin
Serialize builtin data as components (e.g.
bool serialize_table
Serialize entire table vs.
ecs_entity_t serialize_refs
Serialize references (incoming edges) for relationship.
bool serialize_inherited
Serialize inherited components.
ecs_poly_t * query
Query object (required for serialize_query_[plan|profile]).
bool serialize_alerts
Serialize active alerts for entity.
bool serialize_values
Serialize component values.
bool serialize_type_info
Serialize type information.
bool serialize_entity_ids
Serialize entity ids.
bool serialize_matches
Serialize which queries entity matches with.
Used with ecs_iter_to_json().
bool serialize_builtin
Exclude flecs modules & contents.
bool serialize_modules
Exclude modules & contents.