MishkaGervaz.Form.Types.Field.Json (MishkaGervaz v0.0.6)

Copy Markdown View Source

JSON editor field type.

Validates string and structured input against the field's ash_type (:map / Ash.Type.Map accepts only objects; {:array, _} accepts only arrays). On parse_params/2, JSON strings are decoded to native terms; invalid JSON falls through unchanged so the validator can surface the error message.

Example

field :schema, :json do
  ui do
    rows 8
    placeholder ~s([{"@type": "BlogPosting"}])
  end
end

See MishkaGervaz.Form.Behaviours.FieldType and MishkaGervaz.Form.Types.Field.