Sameer
Sameer

Reputation: 21

dart:json in Dart programming language

I have read in some books that dart has a library called dart:json. I have the 1.6 version of the Dart SDK and Dartium but I haven't been able to find any such library.

Upvotes: 1

Views: 442

Answers (1)

Dafen
Dafen

Reputation: 1150

I think what you want is dart:convert wich includes everything you need to work with json. Have a look here.

Example:

var encoded = JSON.encode([1, 2, { "a": null }]);
var decoded = JSON.decode('["foo", { "bar": 499 }]');

JSON.decode gives you a List or Map depending on your JSON string and JSON.encode returns your JSON string.

Upvotes: 5

Related Questions