Import from a JSON sample
A recipe can start from a JSON document you already have — a captured API response, an example row, a fixture. Paste it as a sample and Ghost Bakery reads it as data, not as a recipe: one field per key, with a type chosen from the value alone.
{"id": 123, "valor": 987.654, "ativo": true, "nome": "funny crow"}From that sample, Chef proposes this recipe:
version: "1"
output: { language: eng, format: json, quantity: 10 }
fields:
- { name: id, type: integer }
- { name: valor, type: decimal, precision: 3 }
- { name: ativo, type: boolean }
- { name: nome, type: text }In the app, choose New from JSON sample on the My Recipes page, paste the document, and press Analyze. You review the fields in a table, change any type, then continue into the normal editor. The same inference is available to scripts and AI assistants as POST /api/v1/spec/infer and the MCP tool ghostbakery_infer_recipe.
How a value becomes a type
The type comes from the JSON value alone, with no guesswork about the key name or the text. "country" stays text; a UUID-looking string stays text. You change it afterwards.
| JSON value | Inferred field |
|---|---|
"funny crow" |
text |
123, -45 |
integer |
987.654, 1.5, 1e3 |
decimal, with precision = digits after the point |
true / false |
boolean |
null |
no type (you pick one) |
{ "street": "…", "number": 1 } |
json, mode: object, one child per key |
[ {"id": 1}, {"id": 2} ] |
json, mode: array, maxItems = the longest list, children merged |
["a", "b"] |
text with repeat: {minItems: 1, maxItems: 2} |
[1, 2.5] |
decimal with repeat (integers and decimals merge to decimal) |
[], [[1]], [1, "a"] |
no type, with a warning |
No other parameters are set: bounds, lengths, categories and word counts keep their defaults. You add those in the editor.
Merging
The top level may be an object, or an array of objects, which are merged into one template: the union of their keys, in order of first appearance.
nullnext to another kind is ignored; only nulls leave the field without a type.- An integer next to a decimal becomes
decimal, keeping the largestprecision. - Objects merge recursively; arrays merge element by element,
maxItemstaking the longest. - Any other mix — a string next to a number — leaves the field without a type and records a warning.
A key missing from some objects is not special: no emptyRate is set.
Field names
Each key is turned into a valid field name: letters, digits and underscores, at most 63 bytes. Spaces and punctuation become _, a leading digit gets a _, an empty name becomes field_N, and a duplicate gets _2. Every change is reported as a warning, for example key "data de nascimento" renamed to "data_de_nascimento".
Limits and privacy
A sample may be at most 1 MiB, at most 8 levels deep, and at most 4,096 fields in total. The sample stays in your browser and in the request body only: it is not stored, not logged and not kept. The result is a normal recipe you can save, preview, estimate and generate like any other.