From 2653443aac17fa83be30a6318d29dd76b475a5d1 Mon Sep 17 00:00:00 2001 From: James Fairbanks Date: Wed, 25 Oct 2023 14:44:37 -0400 Subject: [PATCH 1/2] DOC: show how to use JSON3.read for ASKEMDecaExpr --- docs/literate/decapodes_examples.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/literate/decapodes_examples.jl b/docs/literate/decapodes_examples.jl index 02285fa..137a6f8 100644 --- a/docs/literate/decapodes_examples.jl +++ b/docs/literate/decapodes_examples.jl @@ -67,7 +67,11 @@ mpode = ASKEMDecapode(h, d) # The resulting structure is like a parse tree of the syntactic # representation of the DecaExpr -JSON3.pretty(mexpr) +mexpr_json = JSON3.pretty(mexpr) + +# This JSON can be read in with the default JSON3 read function. + +JSON3.read(mexpr_json, ASKEMDecaExpr) # We could also use the JSON serialization built into Catlab # to serialize the resulting combinatorial representation From 4e619b70df1f330cdc2667b1874240789b2ff16c Mon Sep 17 00:00:00 2001 From: James Fairbanks Date: Fri, 2 Feb 2024 11:09:29 -0500 Subject: [PATCH 2/2] use sprint in docs --- docs/literate/decapodes_examples.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/literate/decapodes_examples.jl b/docs/literate/decapodes_examples.jl index 137a6f8..b0e3236 100644 --- a/docs/literate/decapodes_examples.jl +++ b/docs/literate/decapodes_examples.jl @@ -67,7 +67,7 @@ mpode = ASKEMDecapode(h, d) # The resulting structure is like a parse tree of the syntactic # representation of the DecaExpr -mexpr_json = JSON3.pretty(mexpr) +mexpr_json = sprint(JSON3.pretty, mexpr) # This JSON can be read in with the default JSON3 read function.