Type Alias JsonSerializationOptions

JsonSerializationOptions: {
    exclude: string[];
    metadata: ("all" | "wikidata" | "latex")[];
    precision: "auto" | "max" | number;
    repeatingDecimals: boolean;
    shorthands: (
        | "all"
        | "number"
        | "symbol"
        | "function"
        | "dictionary"
        | "string")[];
}

Options to control the serialization to MathJSON when using BoxedExpression.json.

Type declaration

  • exclude: string[]

    A list of space separated function names that should be excluded from the JSON output.

    Those functions are replaced with an equivalent, for example, Square with Power, etc...

    Possible values include Sqrt, Root, Square, Exp, Subtract, Rational, Complex

    Default: [] (none)

  • metadata: ("all" | "wikidata" | "latex")[]

    A list of space separated keywords indicating which metadata should be included in the MathJSON. If metadata is included, shorthand notation is not used.

    Default: [] (none)

  • precision: "auto" | "max" | number

    Number literals are serialized with this precision. If "auto", the same precision as the compute engine calculations is used If "max", all available digits are serialized

    Default: "auto"

  • repeatingDecimals: boolean

    If true, repeating decimals are detected and serialized accordingly For example:

    • 1.3333333333333333 ( \to ) 1.(3)
    • 0.142857142857142857142857142857142857142857142857142 ( \to ) 0.(1428571)

    Default: true

  • shorthands: (
        | "all"
        | "number"
        | "symbol"
        | "function"
        | "dictionary"
        | "string")[]

    A list of space separated keywords indicating which MathJSON expressions can use a shorthand.

    Default: ["all"]