From cb07074246f31b343bd1107b923d7cc0f71fef43 Mon Sep 17 00:00:00 2001 From: panasenco Date: Wed, 28 Apr 2021 16:09:38 -0700 Subject: [PATCH] Replaced object() with pairs() in library(json), and made key type explicit. --- src/lib/json.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/json.pl b/src/lib/json.pl index ff980d7f..5f5ff6c1 100644 --- a/src/lib/json.pl +++ b/src/lib/json.pl @@ -50,8 +50,8 @@ json_chars(Internal) --> json_element(Internal). different types of values based on their principal functor. The principal functors match the types defined in the JSON Schema spec here: https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.1.1 EXCEPT we don't yet support the integer type. There are plans for more JSON Schema support in the near future. */ -json_value(object(Assoc)) --> json_object(Assoc). -json_value(array(List)) --> json_array(List). +json_value(pairs(Pairs)) --> json_object(Pairs). +json_value(list(List)) --> json_array(List). json_value(string(Chars)) --> json_string(Chars). json_value(number(Number)) --> json_number(Number). json_value(boolean(Bool)) --> json_boolean(Bool). @@ -83,7 +83,7 @@ json_members([NextPair|Pairs], Key-Value) --> ",", json_members(Pairs, NextPair). -json_member(Key, Value) --> json_ws, json_string(Key), json_ws, ":", json_element(Value). +json_member(string(Key), Value) --> json_ws, json_string(Key), json_ws, ":", json_element(Value). json_array([]) --> "[", json_ws, "]". json_array([Value|Values]) --> "[", json_elements(Values, Value), "]". -- 2.54.0