this post was submitted on 30 Jul 2024
35 points (94.9% liked)

Programming

17424 readers
27 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
top 2 comments
sorted by: hot top controversial new old
[–] homo_ignotus@programming.dev 9 points 3 months ago

Why use JSON Pointer? We already have structured data (JSON), so what's wrong with ["biscuits", 0, "name"] instead of "biscuits/0/name"? This sidesteps the escaping problem.

And the reason is clearly not brevity, given the rest of the spec.

[–] Deebster@programming.dev 8 points 3 months ago

If you need to refer to a key with ~ or / in its name, you must escape the characters with ~0 and ~1 respectively. For example, to get "baz" from { "foo/bar~": "baz" } you’d use the pointer /foo~1bar~0.

I guess they're using ~ for escaping since backslash is already escaping text content, not that you'd see it very often in keys.

Having magic values instead of using ~~ and ~/ feels ugly.