Core.valid_json: def of bend-schema-lib@0.4.1.0 Import: import bend-schema-lib@0.4.1.0/core.bend as Core Lines 176-197 of bend-schema-lib@0.4.1.0/core.bend: https://jend.leeeet.dev/read.txt?path=bend-schema-lib@0.4.1.0/core.bend&start_line=176&end_line=197 import Base # A value is valid when every number in it is finite. Whether a name repeats # in an object is not checked: RFC 8259 only says names should be unique, a # host's object cannot hold a name twice, and checking it would cost every # member a scan of the members after it. def valid_json(value: Json) -> Bool: match value: case JNull{}: True{} case JBool{value}: True{} case JNumber{bits}: finite_number(bits) case JString{text}: True{} case JArray{Nil{}}: True{} case JArray{head <> tail}: Bool.and(valid_json(head), valid_json(JArray{tail})) case JObject{Nil{}}: True{} case JObject{JMember{key, val} <> tail}: Bool.and(valid_json(val), valid_json(JObject{tail})) Uses (6): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=JMember https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=Json https://jend.leeeet.dev/definition.txt?path=bend-schema-lib@0.4.1.0/core.bend&name=finite_number