Comments (2)
I have noticed that wrapping multiple JSON objects in [ ]
with a comma separator causes this to parse correctly:
julia> s = "[{\"name\":\"Marco\"}, {\"name\":\"Julia\"}]"
"[{\"name\":\"Marco\"}, {\"name\":\"Julia\"}]"
julia> JSON.parse(s)
2-element Vector{Any}:
Dict{String, Any}("name" => "Marco")
Dict{String, Any}("name" => "Julia")
This still leaves the problem of converting a non-delimited multiple-object JSON string to a comma separated one that can be wrapped in brackets.
from json.jl.
Sorry, one more thing. It works if you repeatedly read from a stream:
julia> s = "{\"name\":\"Marco\"} {\"name\":\"Julia\"}"
"{\"name\":\"Marco\"} {\"name\":\"Julia\"}"
julia> stream = IOBuffer(s)
IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=33, maxsize=Inf, ptr=1, mark=-1)
julia> JSON.parse(stream)
Dict{String, Any} with 1 entry:
"name" => "Marco"
julia> JSON.parse(stream)
Dict{String, Any} with 1 entry:
"name" => "Julia"
I will open a PR to add an example like this to the docs.
from json.jl.
Related Issues (20)
- Async test failing locally with `connection refused` HOT 2
- Add `JSON.printfile` function
- Dict written as a String HOT 3
- TagBot trigger issue HOT 3
- JSON.jl 1.0 roadmap?
- JOSN.print throws StackOverflow error
- Pass `s::CS` to all usage of `lower` for dispatch HOT 2
- `JSON.parse(read(io, String))` is faster than `JSON.parse(io)` HOT 1
- Feature: Allow specification of full dictionary type
- Julia crashes with multithreaded JSON.parse HOT 6
- Comment support
- Reconstruct object from custom serialization HOT 1
- parsefile: Windows unlink permission denied
- Use random port during testing HOT 1
- Misaligned character/byte when throwing an error
- Detect circular dependencies while printing JSON HOT 1
- Parse bytes directly HOT 5
- typos HOT 2
- Why this json string cannot be parsed? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json.jl.