format · validate · convert · runs locally

Parse JSON in Dart

How to parse a JSON string into an object and serialize (stringify) an object back to JSON in Dart. dart:convert provides jsonDecode and jsonEncode in the standard library — used across Flutter apps. Need to clean up the JSON first? Use the formatter & validator.

Parse JSON (string → object)

import 'dart:convert';
final obj = jsonDecode(text);

Stringify (object → JSON string)

const encoder = JsonEncoder.withIndent('  ');
final text = encoder.convert(obj);

Frequently asked questions

How do I parse JSON in Dart?

dart:convert provides jsonDecode and jsonEncode in the standard library — used across Flutter apps. Parse with the snippet above; the result is a native object/map you can read.

How do I pretty-print JSON in Dart?

Use the stringify snippet above with indentation, or paste your JSON into the formatter on this page.