# See the License for the specific language governing permissions and
# limitations under the License.
+# Static interface to get Nit objects from a Json string.
+#
+# `String::json_to_nit_object` returns an equivalent Nit object from
+# the Json source. This object can then be type checked by the usual
+# languages features (`isa` and `as`).
module static
-import json_parser
-import json_lexer
+import standard
+private import json_parser
+private import json_lexer
redef class Nvalue
fun to_nit_object: nullable Object is abstract
redef fun items do return [n_value]
end
-redef class String
+redef class Text
fun json_to_nit_object: nullable Object
do
- var lexer = new Lexer_json(self)
+ var lexer = new Lexer_json(to_s)
var parser = new Parser_json
var tokens = lexer.lex
parser.tokens.add_all(tokens)