Skip to main content

normalize_json_value

Function normalize_json_value 

Source
pub fn normalize_json_value(value: Value) -> Value
Expand description

Helper function to normalize AST JSON into a form compatible with TGC.

This function traverses the original JSON value and produces a new one under the following rules:

  1. Remove empty object mappings from JSON arrays.
  2. If a JSON array contains exactly two elements and one is an empty object mapping while the other is not, lift the non-empty element.