I’ve always found it annoying that simple-json doesn’t give you enough context for proper debugging. Case in point:
(NonEmptyList (NonEmpty
(ErrorAtProperty "chummer"
(ErrorAtProperty "skills"
(ErrorAtProperty "skill"
(ErrorAtIndex 2
(ErrorAtProperty "skillgroup"
(TypeMismatch "String" "Object"))))))
Is rather annoying to find the exact position in the JSON to take a closer look at the context. So I built a little function for it, maybe someone else finds it useful. Activate this spago override (until a new release is published):
let overrides = { json-pointer = upstream.json-pointer // { version="v1.1.0" } }
and install json-pointer
. Use jqE
/ jqF
depending on which context you’re in. The message will now look like this:
(NonEmpty "jq '.chummer.skills.skill[2].skillgroup' # to display the json at (TypeMismatch \"String\" \"Object\")"
So if you have the json at hand, you can use jq to display the specific json snippet. It’s been very useful to me so far, maybe someone of y’all might find it helpful.