write json file in the database

3

Is it a good idea?

I was thinking of doing a project where the user will create several elements dynamically (tables, choose a certain option, fill etc), these dynamically generated elements should be saved in the database to be updated, modified (something similar to jsfiddle , where you give an update on an existing project, modify, etc.).

How do developers normally do? Do you record json in the bank? then read it and go generating and populating the elements in html?

{["firstName":{"required":"true","type":"text"},"lastName":{"required":"true","type":"text"}}
    
asked by anonymous 05.08.2015 / 02:27

1 answer

4

Not only can it, as it is a common and recommended practice for this type of situation. In addition, saved data can be used by any language and framework, since JSON is universally understood.

For example, by passing Json to your frontend, with Javascript you create the fields. You can also use Json and generate HTML with PHP. You can even use JSON and generate a screen for an iPhone App, with Swift. And so it goes.

It is so acceptable that major RDBMSs have internal JSON frameworks:

  • PostgreSQL has a native type json and jsonb with several utilitarian functions to handle JSON: link
  • MySQL 5.7.7 also added the JSON type: link

NoSQL banks are purely Json:

  

CouchDB is an open-source database that focuses on ease of use and the philosophy of being "a web-based database" 1. It is a non-relational (NoSQL) database that uses JSON to store data , JavaScript as its query language

    
05.08.2015 / 02:42