Writing JSON Object as Object not as String to File

Writing JSON Object as Object not as String to File

I want to write a JSON Object to a file.Currently I have tried using ObjectMapper and Gson but they are writing the JSON as JSONString, Thus the output file has JSON string rather than object. So is there a way JSON Object is written as Object rather than String

I want to write a JSON Object to a file.Currently I have tried using ObjectMapper and Gson but they are writing the JSON as JSONString, Thus the output file has JSON string rather than object. So is there a way JSON Object is written as Object rather than String

JSONObject responseData = new JSONObject(response.getBody().toString());
org.json.simple.JSONObject object  = new
org.json.simple.JSONObject(responseData.toMap());
ObjectMapper objMapper = new ObjectMapper();
objMapper.writeValue(new File(path) , object);

Now the above code is writing the JSON Object as String in to file not a JSONObject.

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Introduction to JSON - Java

Learn the fundamentals of parsing and manipulating JSON data with the JSON-Java library.

Convert JSON Into Java Object using JackSon Library

Learn to Convert JSON String Into Java Object Using JackSon library. Learn how to convert JSON to Java Object and Java Object to JSON in Java using Jackson API.

How to Convert a Java Object into a JSON String

In this article, you'll learn how to convert a Java Object into a JSON String