Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Unified Diff: pkg/oauth2/lib/src/credentials.dart

Issue 23596007: Remove usage of dart:json. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/oauth2/lib/src/credentials.dart
diff --git a/pkg/oauth2/lib/src/credentials.dart b/pkg/oauth2/lib/src/credentials.dart
index 5bbec169d65969fb7c54761b61fb9ab728a9aebb..13d33204cc2164a32a0b237e19c92c4c1f386119 100644
--- a/pkg/oauth2/lib/src/credentials.dart
+++ b/pkg/oauth2/lib/src/credentials.dart
@@ -5,7 +5,7 @@
library credentials;
import 'dart:async';
-import 'dart:json' as JSON;
+import 'dart:convert';
import 'package:http/http.dart' as http;
@@ -80,7 +80,7 @@ class Credentials {
var parsed;
try {
- parsed = JSON.parse(json);
+ parsed = JSON.decode(json);
} on FormatException catch (e) {
validate(false, 'invalid JSON');
}
@@ -125,7 +125,7 @@ class Credentials {
/// Serializes a set of credentials to JSON. Nothing is guaranteed about the
/// output except that it's valid JSON and compatible with
/// [Credentials.toJson].
- String toJson() => JSON.stringify({
+ String toJson() => JSON.encode({
'accessToken': accessToken,
'refreshToken': refreshToken,
'tokenEndpoint': tokenEndpoint == null ? null : tokenEndpoint.toString(),

Powered by Google App Engine
This is Rietveld 408576698