--- id: reflect-serialize name: Reflect.serialize category: reflect kind: namespace-method tokens: Reflect.serialize sig: Reflect.serialize(entity) -> value tip: Walk an entity's components into a value tree. order: 13 ns: Reflect member: serialize --- Walks every component the entity carries and every field of each into a generic object value tree: one member per component, each a sub-object of its fields. A fixed field becomes a fixed node, everything else an int node, so a serialize → apply round-trip is bit-exact; the model id rides along under the reserved "@kind" key. Pair it with Json.encode for a one-call save. It names no component or field, so it works over any schema — the pattern auto-save and debug inspectors use.