You might have seen some cases where JSON string literal is involved to store in database, filesystem and other storage systems. The most specific case is exchanging JSON data between different programming languages and deserializing the JSON string to native object of the targeted language. The most suitable example would be the
Web API endpoints through which data is transferred in JSON formats between two different platforms. Likewise, there are more real world scenarios where JSON string literal is used significantly.
So, let’s get started with an example:
$user = [
'full_name' => 'Laraphp'
'avatar_url' => 'http://laraphp.com/avatar/laraphp.png'
'email' => 'firstname.lastname@example.org'
var user = JSON.parse(response); // response is created from API call in real world scenario
It is as simple as that. This is a basic example without much back-end details on database call and front-end details on how API call is made and JSON string is returned. We will not cover those details in this article since that would be beyond of this article’s intention. If you want to know front-end and back-end implementation of API completely with real case scenario, please let us know in the comment section. We will be glad and ready to post an article on the requested topic.