
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 204 Articles for JSON

1K+ Views
GSON is java library, It is used to convert OBJECT to JSON and JSON to Object. Internally it going to work based on serialization and deserialization.This example demonstrates how to convert HASHAMP to JSON using GSON library.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code in build.gradle.apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "com.example.andy.myapplication" minSdkVersion 15 targetSdkVersion 28 versionCode ... Read More

299 Views
We can store data in MySQL as JSON with the help of JSON data type. The following is an example. Let us now create a table. mysql> CREATE table JsonAsMySQLDemo -> ( -> id int, -> name varchar(100), -> PageDemo JSON, -> eventInfo JSON -> ); Query OK, 0 rows affected (0.67 sec) Storing records into JSON data type. mysql> INSERT into JsonAsMySQLDemo values -> ( -> 1, ... Read More

5K+ Views
The delete() function of Map object accepts a string representing the key of an element of a map and deletes from the current Map object. This function returns true if the specified key exists in the map object else it returns false.SyntaxIts Syntax is as followsmapVar.delete()Example Live Demo JavaScript Example var mapVar = new Map(); mapVar.set('1', 'Java'); mapVar.set('2', 'JavaFX'); mapVar.set('3', 'HBase'); mapVar.set('4', 'Neo4j'); var map = mapVar.delete('4'); document.write("Size of the map object: "+mapVar.size); ... Read More

254 Views
The stringify() function of a JSON object accepts a JSON string, and constructs an object based on the given text and, returns it.SyntaxIts Syntax is as followsJson.stringify();Example Live Demo JavaScript Example var jsonSample = '{Tutorial: Java, Version:8}'; jsonObj = JSON.stringify(jsonSample); document.write(jsonObj); Output"{Tutorial: Java, Version:8}"

2K+ Views
The json module in python allows you to dump a dict to json format directly. To use it,Exampleimport json my_dict = { 'foo': 42, 'bar': { 'baz': "Hello", 'poo': 124.2 } } my_json = json.dumps(my_dict) print(my_json)OutputThis will give the output −'{"foo": 42, "bar": {"baz": "Hello", "poo": 124.2}}'You can also pass indent argument to prettyprint the json. exampleimport json my_dict = { 'foo': 42, 'bar': { 'baz': "Hello", 'poo': 124.2 } } my_json = json.dumps(my_dict, indent=2) print(my_json)OutputThis will give the output −{ "foo": 42, "bar": { "baz": "Hello", "poo": 124.2 } }

1K+ Views
JSON can be abbreviated as JavaScript Object Notation. It means a script of a text file in a programming language to transfer and store the data. It is supported by the Python programming language using a built-in package named JSON. Its text is given in the quoted string format, which contains a key and value within the curly braces{}, which looks like a dictionary. To access a JSON document using Python, we have to use the JSON package. In this package, we have a method named dumps(), which is used to convert the Python tuple objects into the Java objects. ... Read More

1K+ Views
We can use python-jsonschema-objects which is built on top of jsonschema.The python-jsonschema-objects provide an automatic class-based binding to JSON schemas for use in Python.We have a sample json schema as followsschema = '''{ "title": "Example Schema", "type": "object", "properties": { "firstName": { "type": "string" }, "lastName": { "type": "string" }, "age": { "description": "Age in years", ... Read More

3K+ Views
There is no standard JSON format for dates. Although JavaScript does have a standard date format that is human readable, sorts correctly, includes fractional seconds(which can help re-establish chronology) and conforms to ISO 8601. You can convert a Python date to the JS date format using the strftime function and deserialize it using the client that needs this date. To get an ISO 8601 date in string format in Python 3, you can simply use the isoformat function. It returns the date in the ISO 8601 format. For example, if you give it the date 31/12/2017, it'll give you the ... Read More

891 Views
json is simplejson, added to the stdlib. But since json was added in 2.6, simplejson has the advantage of working on more Python versions (2.4+).simplejson is also updated more frequently than Python. Although they are the same, the version included in the stdlib doesn't include the latest optimizations. So if you need (or want) the latest version, it's best to use simplejson itself, if possible.A good practice, is to use one or the other as a fallback. For example,try: import simplejson as json except ImportError: import json