Skip to content

Commit 5d4d86c

Browse files
committed
Add documentation and better description
1 parent 6e77b81 commit 5d4d86c

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Pedantic style checking
66
- Detailed instructions in README
7+
- Add documentations
78

89
## 0.0.1
910

lib/src/traverser.dart

+9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
import 'dart:convert';
22

3+
/// ElementNotFound Exception implementation, currently simply prints the
4+
/// error message
35
class ElementNotFoundException implements Exception {
46
ElementNotFoundException(String errorString) {
57
print(errorString);
68
}
79
}
810

11+
/// JSONTraverse class, implements the query method as well
912
class JSONTraverse {
1013
Map<String, dynamic> decodedJSON;
14+
15+
/// The constructor converts the `jsonString` to `Map<String, dynamic>`
16+
/// which is used by the `query` method.
1117
JSONTraverse(jsonString) {
1218
decodedJSON = jsonDecode(jsonString);
1319
}
1420

21+
/// The query method takes `queryString` and then splits into an array of
22+
/// strings. The converted map(that is, `decodedJSON`) is then traversed using
23+
/// the splitted strings, reducing it at every step.
1524
dynamic query(String queryString) {
1625
var splittedString = queryString.split('.');
1726
dynamic reduced = decodedJSON;

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: json_traverse
22
version: 0.0.2
33

4-
description: Parse deeply nested JSON using simple query strings.
4+
description: Parse deeply nested JSON using simple query strings with dot separator.
55
homepage: https://github.com/ayan-b/json_traverse
66

77
environment:

0 commit comments

Comments
 (0)