Skip to content

Instantly share code, notes, and snippets.

Forked from kasperpeulen/
Last active Apr 10, 2019
What would you like to do?
How to pretty-print JSON using Dart.
import 'dart:convert';
main() {
Map json = {
'name' : 'Kasper Peulen',
'best_language': 'dart',
'best_chat': ''
JsonEncoder encoder = new JsonEncoder.withIndent(' ');
String prettyprint = encoder.convert(json);
name: dart.convert_JsonEncoder.withIndent
description: |
How to pretty-print JSON using Dart.
How to display JSON in an easy-to-read (for human readers) format.
tags: 'json pretty-print'
sdk: '>=1.0.0 <3.0.0'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment