Skip to main content

Module simplified_json

Module simplified_json 

Source
Expand description

Conjure’s simplified JSON format for parameters and solutions.

Matches Conjure --output-format=json: integers and booleans are JSON scalars, sets and tuples are arrays, records are objects, and int-indexed matrices are objects whose keys are the printed index values. Non-int-indexed matrices encode as arrays.

Functions§

canonical_simplified_json_string
Render pretty JSON with stable key order for golden comparisons.
domains_from_model
Collect find/given domains from a model for JSON parsing guidance.
literal_from_simplified_json
Decode a simplified JSON value, using domain to disambiguate arrays and objects.
literal_to_simplified_json
Encode a literal in Conjure’s simplified JSON format.
param_model_from_assignments
Build a parameter model of value-lettings from simplified JSON assignments.
params_from_simplified_json
Parse a parameter JSON object using given domains from the problem model.
params_from_simplified_json_str
Parse parameter JSON text.
params_to_simplified_json
Render a parameter file as a single simplified JSON object.
solution_from_simplified_json
Parse a single assignment object.
solution_to_simplified_json
Render a single assignment as a simplified JSON object.
solutions_from_simplified_json
Parse a Conjure-style solutions JSON document (array, or a single object).
solutions_from_simplified_json_str
Parse solutions JSON text.
solutions_to_simplified_json
Render solutions as a JSON array of assignment objects (Conjure --solutions-in-one-file).
solutions_to_simplified_json_string
Pretty-print solutions in Conjure’s simplified JSON layout.
write_simplified_json
Append pretty JSON to a string buffer.