Skip to content

[Files\read.json]: "read.json" cannot parse the JSON string containing Arturo source code generated by "write.json". #2206

@scifx

Description

@scifx

Summary

"read.json" cannot parse the JSON string containing Arturo source code generated by "write.json".

Current Behavior

Use this two funciton with arturo sorce file,and you can get the bug.

write.json some arturo source code,get a bug.
bug:$[file] [ error: try [ read.json write.json #[ data: read file ] null ] print error ]

As a contrast

write.json to file,then read.json with filename is fine

nobug: $[file outpath] [ write.json #[ data: read file ] outpath error: try [ read.json outpath ] print error ]

Expected Behavior

no errors, should output the "arturo" dictionary object

Steps To Reproduce

Use this two funciton with arturo sorce file,and you can get the bug.

;first, run the bug and nobug functions in repl

$> bug "ai.art"
Runtime Error: httpclient.nim(1154, 13) `not url.contains({'\r', '\n'})` url shouldn't contain any newline characters
Async traceback:
  fatal.nim(53) sysFatal
Exception message: httpclient.nim(1154, 13) `not url.contains({'\r', '\n'})` url shouldn't contain any newline characters

$> nobug "ai.art" "data.json"
;some "arturo" dictionary object

#fine

Note: Not all "arturo" source files will cause errors, but when you try different complex files, you will find many bugs

OS

windows 11 ,linux mint

Version

0.10.1-dev,0.9.84-alpha (maybe all version)

Anything else?

When using the "AI agent" written by Arturo to read the Arturo file, it immediately exits. The Arturo source code file behaves like a "bomb"


nobug_encode:$[file] [ a:read.json write.json #[ data: encode read file ] null a\data: decode a\data return a ]

I've found a solution😁, a sudden flash of insight! I'll encode the base64 first, then convert it to a dictionary, and finally decode it. This way, I can put the art file content into the dictionary. Even with this method, the read.json function still seems to have a bug?🤔

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions