• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

How is form data converted into JSON at "POST" call?  RSS feed

 
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know how to make a post call using chrome's "postman", you write JSON data manually and make a post call.
But how does it exactly happen in real web applications when two applications want to communicate, one application wants to save data into another's db?
How is the form data converted into JSON and accepted by the POST method?

Thanks in advance.
 
Bartender
Posts: 1856
81
Android Chrome IntelliJ IDE Java MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally speaking most of the time GET and POST are used and they both format the data the same way except when a binary file is uploaded using the <input type=file/> tag.
The data is formatted as name values pairs as shown below:
This is parsed intoForm data is not always transformed into a JSON object. There is not always a reason to.
However if we know that then we can create a JSON object like this
So we could in theory send this via POSTHere we are sending both a JSON object and some other values e.g. otherValue and clientVersion.
Now that it's sent to the server someone would need to either use one of the many JSON parses to extract the values or (not recommended) create their own.
The server code now has the individual elements which can be inserted into the database using a SQL statement and the database server could be a different system half way around the world.

In theory one could do most of this with string manipulation using method like indexOf, subString, replace etc.
However there are many free libraries out there for most environments which can do this quicker for you.

Do you have a specific example which you would like to go over?
 
Arun Singh Raaj
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the information.
Yes, is it true that a seller can manage the products on
e-commerce websites like amazon directly through their API?
 
Arun Singh Raaj
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean if a seller has their own website of warehouse and their website interact with amazon's website directly through REST?
 
Pete Letkeman
Bartender
Posts: 1856
81
Android Chrome IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please clarify what you are stating/asking Arun Singh Raaj?
If you make a REST call all that you are doing is making a web request to a web site which is hosted somewhere.
The web site processes the web request and you don't have to care how it's handled as long as it's handle and you get the response you expect.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!