Skip to content

Instantly share code, notes, and snippets.

@rodydavis
Forked from kasperpeulen/README.md
Last active Apr 10, 2019
Embed
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': 'https://dartlang.slack.com'
};
JsonEncoder encoder = new JsonEncoder.withIndent(' ');
String prettyprint = encoder.convert(json);
print(prettyprint);
}
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'
homepage: https://gist.github.com/kasperpeulen/d61029fc0bc6cd104602
environment:
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