Placing JSON versus traditional forms of encoded data as a data format for form submission

JSON placement compared to traditional form coding as a data format for sending data to a server from an HTML form. The HTML form is dynamic, as the user can add new lines (for example) and fill in the data. There is an argument that using form fields with an MVC map is easier in this case, since an MVC structure such as Spring MVC takes care of form bindings (generating an identifier in dynamically generated HTML, etc.), and we can have an object on the controller to collect these values ​​when the form is submitted using AJAX as a type of coded type.

I was thinking about using JSON, what are your views?

  • Does it use a format encoded in a form (traditional way), is it better, or does it use JSON as a payload? What are some of the pros and cons you have come across?
  • Are web applications using JSON as the data format for submitting forms?
  • We currently do not have integration with mobile applications, etc., so is it worth using JSON over traditional field forms?

Thank you for your time.

+7
source share
5 answers

Does form fields use a better option or use a JSON path?

You compare apples with hammers. JSON is a data format, and a form is, say, a data source. You can send JSON data to HTML form fields, so this question is a bit odd.

Are web applications using JSON to submit forms?

HTML forms? Not

We currently do not have integration with mobile applications, etc., so is it worth using JSON over traditional field forms?

Again - read about the technologies you want to use. It helps to understand what it is. Do not start the implementation until you get basic knowledge, otherwise you are wasting your time refactoring your project. From scratch...

-2
source

1. Does the form field use the best option or use the JSON path?

You cannot compare it. What you can say is either traditional Submit is better or the JSON method, but you need to make a choice. When sending via JSON, you cannot send files, but AJAX or similar technology is required to work with the server. Accordingly, browser compatibility.

2. Are web applications using JSON to submit forms?

The question itself is wrong. There is no answer, because most forms are represented by POST , and the values ​​are sent as serialized, which does not always mean JSON.

3. Currently, we do not have integration with mobile applications, etc., So is it worth using JSON over traditional forms?

Again, browser compatibility and user bandwidth play an important role. If people have good browsers, go for it.

My suggestion:

There are many rules and best practices for developing all kinds of web applications. Please go through this and work on your project. :)

+6
source

I would recommend that you stick to the standard format of the structure used. In terms of performance, security and reliability, the people who develop your infrastructure will work much better than when developing such an infrastructure.

In this article The normal presentation form compared to JSON there is a bit of discussion on the subject of submitting the main form and submitting JSON. One point that I agree with is that when you begin to penetrate complex data structures, a structured format, as opposed to a flat one, can be quite useful. However, as you yourself said, Spring MVC and other similar structures take care of binding. For me, this is the only thing JSON can do much better than the standard form feed. If by default it takes care of this, stick to the default value. Do not add complexity where it is not needed.

+3
source

Do you have any specific reasons for posting JSON?

If not, I would say that the default choice would be to publish the form data, as this is supported by all browsers and all servers. You can publish form data without any script client at all, and any server implementation processes it by default.

+1
source

Update Take a look at http://www.w3.org/TR/html-json-forms/

But "Beware. This specification is no longer in active service, and the HTML working group does not intend to support it further."

0
source

All Articles