B
B
beduin012020-07-06 16:57:14
JSON
beduin01, 2020-07-06 16:57:14

What is the best way to scatter 20 JSON combinations across database fields?

I have 20 JSON types. I can determine the type only by the structure of the fields. there is no obvious sign. 10 types coincide in fields by 95%. the remaining 10 have practically no common fields.
Moreover, they differ only in nested fields, i.e. common basis.
{
id: ...
name: ...
objs: {
// this could be the difference between the fields
}
}

I need to put all the data in Postgres. How to be? Create 20 classes? And how then to check which of the JSON maps to which class?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2020-07-06
@firedragon

Create a subclass. And inside it, store naked jison, in principle, you only need to search by Id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question