Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert JSON object into REST API

Is there any tool or library available which can generate REST API from JSON file. Independent of language. On the basis of JSON object generate REST API.

for Example:

{  
  "name": "set",
  "type":"function",
  "inputs":[{"name":"num", "type":"int"}]
  "output":[{"name":"value", "type":"int"}]
}

Clarification:

The JSON file will contain function and its detail like name, input argument and output(return) parameters.
So according to this JSON file, REST API methods should be generated for the function described in the JSON.
For ex: A function named set and it is accepting one argument num of int type and returning a value of int type.
Is it possible to generate REST API method for this function like GET and POST from the knowledge of JSON file only?

Hope it clears the question!

like image 348
Shubham Chadokar Avatar asked Sep 22 '26 18:09

Shubham Chadokar


1 Answers

You can use swagger (https://swagger.io/, https://generator.swagger.io/)

It can generate API (supports different languages) from openAPI spec file.

The spec file can be json or yaml.

You should transform your json to spec-specific json format.

like image 99
Eugene Mihaylin Avatar answered Sep 25 '26 12:09

Eugene Mihaylin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!