Print.print: def of emerging-ezjson@1.3.0.0 Import: import emerging-ezjson@1.3.0.0/src/print.bend as Print Lines 70-102 of emerging-ezjson@1.3.0.0/src/print.bend: https://jend.leeeet.dev/read.txt?path=emerging-ezjson@1.3.0.0/src/print.bend&start_line=70&end_line=102 import Base import emerging-ezjson@1.3.0.0/src/value.bend as V # a value as compact JSON def print(val: V.Json) -> String: match val: case V.JNull{}: "null" case V.JBool{True{}}: "true" case V.JBool{False{}}: "false" case V.JNum{raw}: raw case V.JStr{s}: quote(s) case V.JSpan{src, +n}: quote(V.span.str(src, n, U32.is_zero(n))) case V.JArr{items}: "[" ++ print(items) ++ "]" case V.JObj{pairs}: "{" ++ print(pairs) ++ "}" case V.JNil{}: "" case V.JCons{h, V.JNil{}}: print(h) case V.JCons{h, t}: print(h) ++ "," ++ print(t) case V.JPair{k, v, V.JNil{}}: quote(k) ++ ":" ++ print(v) case V.JPair{k, v, r}: quote(k) ++ ":" ++ print(v) ++ "," ++ print(r) case V.JBind{src, +n, v, V.JNil{}}: quote(V.span.str(src, n, U32.is_zero(n))) ++ ":" ++ print(v) case V.JBind{src, +n, v, r}: quote(V.span.str(src, n, U32.is_zero(n))) ++ ":" ++ print(v) ++ "," ++ print(r) Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_zero https://jend.leeeet.dev/definition.txt?path=emerging-ezjson@1.3.0.0/src/print.bend&name=quote https://jend.leeeet.dev/definition.txt?path=emerging-ezjson@1.3.0.0/src/value.bend&name=Json https://jend.leeeet.dev/definition.txt?path=emerging-ezjson@1.3.0.0/src/value.bend&name=span.str