Skip to content

Change @type to type #5

Open
Open

Description

@jvandriel

Even though the specification states that the EntityMap should be in plain json, it makes use of the json-ld specific keyword @type, making it invalid json. To fix this, use type (without the @) instead of @type.

Activity

  1. DixonJones commented on May 29, 2026

    @DixonJones

    I may be wrong here, so push back if so. But I don't think @type is actually invalid JSON. The @ character is perfectly legal in a string key and any conformant parser will swallow it without complaint.

    The real question is a different one: the file borrows a JSON-LD convention without declaring a @context, which is admittedly a bit odd. Whether that matters depends on what we want this format to be.

    As I see it, there are four options, including doing nothing:

    1. Document the intent. State clearly that @type is a deliberate JSON-LD borrow for semantic clarity, with no full JSON-LD compliance implied. Job done.
    2. Go the whole way. Add a @context and make it properly JSON-LD-compliant. Opens up graph tooling, but adds complexity.
    3. Rename to type. Clean break from JSON-LD, plain JSON field. Simpler, but loses the semantic signal.
    4. Leave it alone. It works, developers recognise it, nothing is actually broken.

    Option 4 is probably the path of least resistance, but I can see a case for option 1 just to close down this kind of confusion. Interested in what others think.

  2. jvandriel commented on Jun 1, 2026

    @jvandriel
    Author

    I guess it all depends on how strict you want/need the json file to be. You're correct to state that an @ may be used in a key string, nevertheless there are situations where it can cause issues, depending on the strictness of the consuming party/API (I've seen my fair share of scripts/APIs crashing on @'s used in keys).

    If it were up to me I'd go for option (3), but that's because I generally go by the rule: "It's better to be strict than sorry", especially since it can be really difficult to change things after a protocol/standard has been adopted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions