l a s
l a s

Reputation: 3923

json schema containing multiple independent types

Is there any example to show how a json schema can be written to include multiple independent objects in one file?

If its possible, is there any java library that can convert all of them to individual pojos and vice versa?

Upvotes: 0

Views: 548

Answers (1)

TimoStaudinger
TimoStaudinger

Reputation: 42460

JSON requires you to always have either one array or one object as root element. If that is not the case, it is not valid JSON.

That being said, why don't you just wrap your multiple indidpendent objects in one root object? Doing this, you will be able to use any functional JSON marshaller.

Upvotes: 1

Related Questions