dov.amir
dov.amir

Reputation: 11637

Does JSON have a schema?

Do JSON / RESTful Web services have a schema equivalent to a wsdl?

If the answer is no, then how do two sides agree on a shared format?

If the answer is yes, are there any tools to auto generate JSON Java client/server from the schema?

Upvotes: 20

Views: 7330

Answers (2)

Mark
Mark

Reputation: 477

I is possible to have a schema for restful web services and some tools support this. But it is common for restful web services to be published without the publishing organisation providing a machine readable schema.

Usually they provide some human readable documentation describing the structure of the JSON. The consumer writes a simple hand written library to consume it (much easer than it sounds in practice with modern tools) or the publisher provides a client library for users to use.

Also JSON/RESTfull web services tend to be carefully designed to deliver simple datastructers over the wire which are easy to consume. Do you need a schema for a list?

Upvotes: 6

Tomasz Nurkiewicz
Tomasz Nurkiewicz

Reputation: 340733

JSON has a schema. REST services have WADL.

Also there are tools like wadl2java.

Upvotes: 12

Related Questions