Pretty Print JSON In Python

Table of Contents Introduction Why do you need to prettify the JSON data? Prerequisites Pretty Print JSON Source Code Introduction In this example I am going to show you how to pretty print JSON in Python programming language. The ugly JSON or one liner JSON data or string could be very difficult to read manually and that’s why you may…

Pretty Print JSON In PHP

Table of Contents Introduction Why do you need to pretty print JSON data? Prerequisites Pretty Print JSON Source Code Introduction Here in this example I am going to show you how to pretty print JSON in PHP program. I will use three different kind of JSON inputs to prettify them in the output. I am going to show you how…

How to convert JSON to CSV in PHP

Here I am going to show you how to convert JSON into CSV using PHP programming language. I will show you both on how to convert JSON string or JSON file to CSV string or file. In my previous example I had shown you how to convert CSV to JSON in PHP. JSON is an acronym and stands for JavaScript…

How to return Different Response Formats (JSON, XML) in Flask REST API

Here I am going to show you how to return different response formats (content negotiation) from Flask REST API. The default response format you receive from the REST API is JSON (JavaScript Object Notation). Now for some requirements you may need to return XML format from your REST API. Then this example may help you how to do it. I…

How to convert CSV to JSON in PHP

In this example I am going to show you how to convert CSV to JSON using PHP programming language. CSV stands for comma separated values and JSON stands for JavaScript Object Notation. These are actually data formats used for representations. Having data formats in CSV and JSON are advantageous because of their light-weight, easy to representation and easy to parse….

How to return Different Data Formats (JSON, XML) from Spring REST API

Introduction Here I am going to show you an example on how to return different data formats from REST API using Spring Boot framework. You may have a requirement that you need to return multiple formats, such as XML, JSON, etc., from the REST response, then this example may help you. This example will return XML and JSON format depending…

How To Pretty Print JSON In Java

Table of Contents Introduction Why do you need to pretty print JSON data? Prerequisites pretty Print JSON Using Jackson Library Using Google GSON Library Using JSON Library Source Code Introduction Here I am going to show you how to pretty print JSON in Java. I am going to use here JSON, Jackson and Google Gson libraries to prettify the JSON…

How To Load Local JSON File In Angular Application

JSON File JSON, i.e., JavaScript Object Notation is a lightweight format for interchanging data. It is based on a subset of JavaScript language. For example, this JSON data format is used in the webservice response. In old days webservices used XML for the primary data format but nowadays JSON, being lightweight, is becoming the preferred data format for exchanging data…

Sanitize JSON using Java

Introduction Here I am going to tell you how to sanitize JSON (JavaScript Object Notation) string using Java program. Given JSON-like content, convert it to valid JSON. The OWASP JSON Sanitizer Project is a simple to use Java library that can be attached at either end of a data-pipeline to help satisfy Postel’s principle: be conservative in what you do,…

Gson Jackson To Map JSON To POJO And POJO To JSON

Introduction This tutorial will show you how you can map JSON string to a list of POJO objects and a list of POJO objects to JSON string using Google API’s Gson as well as Jackson API’s ObjectMapper. I will create nested POJO objects from JSON string or JSON string to nested POJO objects using both Gson and Jackson API.