starlark/lib/json: a JSON module for Starlark
This CL ports the go.starlark.net/starlarkjson module from Go to Java.
The json module provides four functions:
json.decode
json.encode
json.indent (not yet implemented)
json.encode_indent (not yet implemented)
It is tested through eval.ScriptTest, which adds the json module to
its environment, along with 'struct', a simple struct-like type.
Some tests are commented out, awaiting StarlarkFloat, or richer string support.
This is a first step towards removing Bazel's struct.to_json.
Updates bazelbuild/starlark#83
PiperOrigin-RevId: 337944489
diff --git a/src/BUILD b/src/BUILD
index fe7bb28..88acc04 100644
--- a/src/BUILD
+++ b/src/BUILD
@@ -449,6 +449,7 @@
"//src/main/java/com/google/devtools/common/options:srcs",
"//src/main/java/net/starlark/java/cmd:srcs",
"//src/main/java/net/starlark/java/spelling:srcs",
+ "//src/main/java/net/starlark/java/lib/json:srcs",
"//src/main/native:srcs",
"//src/main/protobuf:srcs",
"//src/main/tools:srcs",