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…

Sort MySQL Table Data in Ascending or Descending Order in CodeIgniter 4

In this tutorial I am going to show you how to sort MySQL table data in ascending or descending order to display them on HTML table on user interface (UI) using Codeigniter 4. I had also shown similar example using CodeIgniter 3. So when a user wants to see the data on UI either in ascending or descending order then…

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….

Django 3, MySQL REST API Angular 10 CRUD Example

Here in this tutorial I am going to explain how to integrate Django REST API with Angular framework. CRUD stands for Create, Read, Update and Delete operations which will be performed from UI (User Interface) using Angular framework and on server side Django framework and MySQL server are used. The Angular framework will be used in this example for representing…

How to mask a Field or an Attribute in Java

Here I am going to show you how to mask a field or an attribute in Java programming language. This kind of situation occurs when you are dealing with mainly debit or credit cards. So you have a POJO or model class for your card (debit or credit) but for security reason you do not want to display the card…

CodeIgniter 4 REST API, MySQL and Angular 10 CRUD Example

I am going to show you an example on Angular CodeIgniter 4 REST API MySQL CRUD. CRUD is an acronym and stands for Create, Read, Update and Delete operations. REST or RESTful is a Representational State Transfer which defines an architectural style in software engineering. The REST API works on HTTP or HTTPS protocol. The Angular framework will be used…

Junit 5 Mockito Verify Example

In this example I am going to show you how to verify a method has been executed at least. Why do you need to verify method execution? Consider the void method, in your Java class, which you want to perform Junit test case on it and you don’t have any way to tell whether your method successfully tested or not….

Junit 5 Expected Exception using Assertions.assertThrows()

This example will show you how to work with expected exception using Junit 5 Assertions.assetThrows(). Junit 4 (at least 4.7 version) provides expected attribute with @Test annotation, where you can mention what exception you are expecting from your test method but Junit 5 does not provide such thing. Junit 5 provides assertThrows() that can be used to check the expected…

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…