2

This answer state that:

The ERD diagram on the other side, is a persistence-specific diagram which display the entities (tables) existing in a (most often) relational database.

Q1 : I'm curious because I rarely see JSON is represented in ERD. What are the reasons behind that?

Q2 : Is it valid if I use ERD to represent my JSON model in ERD since JSON is not a relationship data model?

Thank you!

Community
  • 1
  • 1

1 Answers1

1

JSON is a notation for an hierarchical data structure consisting of scalar values, arrays and objects, nested to any depth. Any hierarchical structure has an inherent preference for one particular relationship (containment) among its component values. Other relationships are possible to represent but are poorly supported - lookup values have to be dereferenced manually, and references can be used instead of lookup values but then the data has to be constructed procedurally since the referenced object has to exist before the referring object, which means it can't be represented in a declarative notation like JSON. Another weakness of hierarchical data structures is that entity identity is often hidden.

In contrast, the relational model (and the entity-relationship model, which is just a thin interpretation of the former) makes identity explicit and can handle any number of relationships between values without favoring one to the detriment of the rest.

JavaScript data can usually be decomposed into a relational structure, by identifying the type of each record/object and identifying or introducing identifiers for each type, then identifying functional dependencies before normalizing. An ERD can be used at this point to describe the relational structure, but as you can see there's some work to transform the hierarchical data into a set of tables.

reaanb
  • 9,806
  • 2
  • 23
  • 37