Jeff Evans
Jeff Evans

Reputation: 1307

Is JSON-LD compaction supposed to remove the at @ from @id and @type?

If you visit the JSON-LD playground page here, and click the "Person" example (which, as of this writing, is this), then the output of the compaction contains an attribute called "type", not "@type" which is what I would expect (since the latter corresponds to the JSON-LD type keyword).

What is it about the compaction algorithm that removes the at symbol from the type? If you click on the "Activity" example, the compacted result does contain "@type". Why is there a difference in processing these two inputs?

Upvotes: 0

Views: 330

Answers (1)

Markus Lanthaler
Markus Lanthaler

Reputation: 3823

This is a feature called Keyword Aliasing. Schema.org recently added a keyword alias form @type to just type and @id to id to their context and that's why you set that. The compact tab of the person example uses Schema.org's context for the compaction.

Upvotes: 1

Related Questions