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…

Posted in Python

Pretty Print JSON In Python

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…

Posted in PHP

Pretty Print JSON 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…

Posted in PHP

How to convert JSON to CSV in PHP

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…

Posted in Flask

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

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…

Posted in PHP

How to convert CSV to JSON in PHP

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…

Posted in Spring Boot Spring REST

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

You are not going to always return records from MongoDB but sometimes you need to perform some computations such as sum, count, average, etc. Here you need the aggregation operations which are used to process data that return the computed results. Therefore aggregation actually groups data from multiple documents and performs a variety of operations…

Posted in MongoDB

MongoDB Aggregation Operations

You may not want to fetch a whole bunch of data from the document which is stored in a collection in your MongoDB database. You can restrict the number of records or data using different conditions with the help of WHERE, AND, OR and IN operators, but what if you want to restrict the data…

Posted in MongoDB

MongoDB find() method with Projection

MongoDB is one of the most popular NoSQL database where data are stored in the form of documents. You can also create tables in traditional way to put your structured data but the main purpose is to store unstructured data in the form of object which may vary based on a particular requirement. Now when…

Posted in MongoDB

How to query documents – WHERE, AND, OR, IN conditions in MongoDB

MongoDB is one of the most popular NoSQL database where your data are stored in a collection. To quickly access your data from MongoDB you can execute commands on MongoDB shell and your results appear based on the given criteria. One of the commands is find() function and using this command you can easily retrieve…

Posted in MongoDB

How to make output of MongoDB’s find() readable in shell

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…

Posted in Java

How To Pretty Print JSON In Java

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…

Posted in Angular

How To Load Local JSON File In Angular Application