110 const char *filename,
150 ecs_strbuf_t *buf_out);
180 ecs_strbuf_t *buf_out);
209 ecs_strbuf_t *buf_out);
230#define ECS_ENTITY_TO_JSON_INIT (ecs_entity_to_json_desc_t){true, false,\
231 false, false, false, true, false, true, false, false, false, false, false,\
262 ecs_strbuf_t *buf_out,
295#define ECS_ITER_TO_JSON_INIT (ecs_iter_to_json_desc_t){\
296 .serialize_term_ids = true, \
297 .serialize_term_labels = false, \
298 .serialize_ids = true, \
299 .serialize_id_labels = false, \
300 .serialize_sources = true, \
301 .serialize_variables = true, \
302 .serialize_is_set = true, \
303 .serialize_values = true, \
304 .serialize_entities = true, \
305 .serialize_entity_labels = false, \
306 .serialize_entity_ids = false, \
307 .serialize_entity_names = false, \
308 .serialize_variable_labels = false, \
309 .serialize_variable_ids = false, \
310 .serialize_colors = false, \
311 .measure_eval_duration = false, \
312 .serialize_type_info = false, \
313 .serialize_table = false, \
314 .serialize_rows = false, \
315 .serialize_field_info = false, \
316 .serialize_query_info = false, \
317 .serialize_query_plan = false, \
318 .serialize_query_profile = false, \
319 .dont_serialize_results = false, \
348 ecs_strbuf_t *buf_out,
389 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.
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_iter_to_json(const ecs_world_t *world, ecs_iter_t *iter, const ecs_iter_to_json_desc_t *desc)
Serialize iterator into JSON string.
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 int ecs_iter_to_json_buf(const ecs_world_t *world, ecs_iter_t *iter, ecs_strbuf_t *buf_out, const ecs_iter_to_json_desc_t *desc)
Serialize iterator into JSON string buffer.
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_label
Serialize doc name.
bool serialize_alerts
Serialize active alerts for entity.
bool serialize_brief
Serialize brief doc description.
bool serialize_hidden
Serialize ids hidden by override.
bool serialize_path
Serialize full pathname.
bool serialize_private
Serialize private components.
ecs_entity_t serialize_refs
Serialize references (incoming edges) for relationship.
bool serialize_id_labels
Serialize labels of (component) ids.
bool serialize_matches
Serialize which queries entity matches with.
bool serialize_link
Serialize doc link (URL)
bool serialize_ids
Serialize (component) ids.
bool serialize_type_info
Serialize type info (requires serialize_values)
bool serialize_color
Serialize doc color.
bool serialize_base
Serialize base components.
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_ids
Serialize actual (matched) component ids.
bool serialize_query_plan
Serialize query plan.
bool serialize_rows
Use row-based serialization, with entities in separate elements.
bool serialize_id_labels
Serialize actual (matched) component id labels.
bool measure_eval_duration
Serialize evaluation duration.
bool serialize_variable_ids
Serialize numerical ids for variables.
bool serialize_query_profile
Profile query performance.
bool serialize_query_info
Serialize query terms.
bool serialize_sources
Serialize sources.
bool dont_serialize_results
If true, query won't be evaluated.
bool serialize_colors
Serialize doc color for entities.
bool serialize_entities
Serialize entities (for This terms)
bool serialize_field_info
Serialize metadata for fields returned by query.
bool serialize_variables
Serialize variables.
bool serialize_entity_names
Serialize names (not paths) for entities.
bool serialize_variable_labels
Serialize doc name for variables.
bool serialize_table
Serialize entire table vs.
bool serialize_term_ids
Serialize query term component ids.
bool serialize_term_labels
Serialize query term component id labels.
bool serialize_private
Serialize component values.
ecs_poly_t * query
Query object (required for serialize_query_[plan|profile]).
bool serialize_entity_labels
Serialize doc name for entities.
bool serialize_values
Serialize component values.
bool serialize_type_info
Serialize type information.
bool serialize_entity_ids
Serialize numerical ids for entities.
bool serialize_is_set
Serialize is_set (for optional terms)
Used with ecs_iter_to_json().
bool serialize_builtin
Exclude flecs modules & contents.
bool serialize_modules
Exclude modules & contents.