Git Product home page Git Product logo

Comments (12)

alexcb avatar alexcb commented on August 18, 2024

The only recent change was the handling of escaping control characters: c3f3650

It sounds like your input data once was a character vector of length 1 (a string), and now it's a list() with a string in it. You'll need to look at your input data. If the input data hasn't changed, then I can take a look provided you give me a (small) sample which I can use to reproduce the problem.

If you come up with a recursive convert single item lists back to vectors, we could include it as a helper function. (and vice-versa promote vectors to lists to ensure that single length vectors get output as lists)

Thanks,
Alex

from rjson.

alexcb avatar alexcb commented on August 18, 2024

This doesn't show any of the behaviour described:

cat(toJSON(list(a="hello\u0004")))
{"a":"hello\u0004"}

cat(toJSON(c(a="hello\u0004")))
{"a":"hello\u0004"}

from rjson.

caitiecollins avatar caitiecollins commented on August 18, 2024

Hey,

Thanks for getting back to me so quickly!

If you have a second, can you take a look at these objects? They were the
ones partaking in the current problem.
The main file of interest is "out.Rdata", which when I use in the line:

noquote(toJSON(out))

generates the object in JSON format with the problematic square brackets.

The other files I'm including are "out.nodes.Rdata" and "out.edges.Rdata",
which are the two components of the object "out", which was created like
so:

out <- list(nodes = out.nodes, edges = out.edges)

And then finally just for your reference, I've included "out.JSON.Rdata"
which contains the problematic output of the noquote(toJSON(out)) command.

Please let me know if you can reproduce the problem, and then what your
thoughts on it are.

Thanks again,
Caitlin.

On Thu, Nov 6, 2014 at 4:04 PM, Alex Couture-Beil [email protected]
wrote:

This doesn't show any of the behaviour described:

cat(toJSON(list(a="hello\u0004")))
{"a":"hello\u0004"}

cat(toJSON(c(a="hello\u0004")))
{"a":"hello\u0004"}


Reply to this email directly or view it on GitHub
#5 (comment).

from rjson.

alexcb avatar alexcb commented on August 18, 2024

Would you be able to produce an example that I can just copy and paste into
R without having to load any external files please.

On Thu, Nov 6, 2014 at 8:20 AM, caitiecollins [email protected]
wrote:

Hey,

Thanks for getting back to me so quickly!

If you have a second, can you take a look at these objects? They were the
ones partaking in the current problem.
The main file of interest is "out.Rdata", which when I use in the line:

noquote(toJSON(out))

generates the object in JSON format with the problematic square brackets.

The other files I'm including are "out.nodes.Rdata" and
"out.edges.Rdata",
which are the two components of the object "out", which was created like
so:

out <- list(nodes = out.nodes, edges = out.edges)

And then finally just for your reference, I've included "out.JSON.Rdata"
which contains the problematic output of the noquote(toJSON(out)) command.

Please let me know if you can reproduce the problem, and then what your
thoughts on it are.

Thanks again,
Caitlin.

On Thu, Nov 6, 2014 at 4:04 PM, Alex Couture-Beil <
[email protected]>
wrote:

This doesn't show any of the behaviour described:

cat(toJSON(list(a="hello\u0004")))
{"a":"hello\u0004"}

cat(toJSON(c(a="hello\u0004")))
{"a":"hello\u0004"}


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).

from rjson.

caitiecollins avatar caitiecollins commented on August 18, 2024

Hi,

Sure, here is some dummy code to get the list type I have and the
bracketing problem I get when I run toJSON:

node <- list(1,2,3,4,5,6)
names(node) <- c("id", "label", "x", "y", "size", "color")

edge <- list(7,8,9,10,11,12)
names(edge) <- c("id", "source", "target", "color", "type", "size")

out.nodes <- list()
for(i in 1:20){
out.nodes[[i]] <- node
}

out.edges <- list()
for(i in 1:19){
out.edges[[i]] <- edge
}

out <- list(nodes= out.nodes, edges= out.edges)

out.JSON <- noquote(toJSON(out))

out.JSON

Can you copy and paste that and see if you get the same abundance of square
brackets as I do in the resulting "out.JSON" object?

Thanks very much.

Cheers,
Caitlin.

On Thu, Nov 6, 2014 at 5:14 PM, Alex Couture-Beil [email protected]
wrote:

Would you be able to produce an example that I can just copy and paste
into
R without having to load any external files please.

On Thu, Nov 6, 2014 at 8:20 AM, caitiecollins [email protected]
wrote:

Hey,

Thanks for getting back to me so quickly!

If you have a second, can you take a look at these objects? They were
the
ones partaking in the current problem.
The main file of interest is "out.Rdata", which when I use in the
line:

noquote(toJSON(out))

generates the object in JSON format with the problematic square
brackets.

The other files I'm including are "out.nodes.Rdata" and
"out.edges.Rdata",
which are the two components of the object "out", which was created
like
so:

out <- list(nodes = out.nodes, edges = out.edges)

And then finally just for your reference, I've included
"out.JSON.Rdata"
which contains the problematic output of the noquote(toJSON(out))
command.

Please let me know if you can reproduce the problem, and then what your
thoughts on it are.

Thanks again,
Caitlin.

On Thu, Nov 6, 2014 at 4:04 PM, Alex Couture-Beil <
[email protected]>
wrote:

This doesn't show any of the behaviour described:

cat(toJSON(list(a="hello\u0004")))
{"a":"hello\u0004"}

cat(toJSON(c(a="hello\u0004")))
{"a":"hello\u0004"}


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).

from rjson.

alexcb avatar alexcb commented on August 18, 2024

Thanks for the sample code. I trimmed down the number of loops for the
dummy data.

I don't see any problems on my end:

{"nodes":[{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6},{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6}],"edges":[{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12}]}

Perhaps you could try working the reproduction case down to the smallest
amount of input data, and include the buggy serialized json as well.

Cheers

On Thu, Nov 6, 2014 at 11:19 AM, caitiecollins [email protected]
wrote:

Hi,

Sure, here is some dummy code to get the list type I have and the
bracketing problem I get when I run toJSON:

node <- list(1,2,3,4,5,6)
names(node) <- c("id", "label", "x", "y", "size", "color")

edge <- list(7,8,9,10,11,12)
names(edge) <- c("id", "source", "target", "color", "type", "size")

out.nodes <- list()
for(i in 1:20){
out.nodes[[i]] <- node
}

out.edges <- list()
for(i in 1:19){
out.edges[[i]] <- edge
}

out <- list(nodes= out.nodes, edges= out.edges)

out.JSON <- noquote(toJSON(out))

out.JSON

Can you copy and paste that and see if you get the same abundance of
square
brackets as I do in the resulting "out.JSON" object?

Thanks very much.

Cheers,
Caitlin.

On Thu, Nov 6, 2014 at 5:14 PM, Alex Couture-Beil <
[email protected]>
wrote:

Would you be able to produce an example that I can just copy and paste
into
R without having to load any external files please.

On Thu, Nov 6, 2014 at 8:20 AM, caitiecollins [email protected]

wrote:

Hey,

Thanks for getting back to me so quickly!

If you have a second, can you take a look at these objects? They were
the
ones partaking in the current problem.
The main file of interest is "out.Rdata", which when I use in the
line:

noquote(toJSON(out))

generates the object in JSON format with the problematic square
brackets.

The other files I'm including are "out.nodes.Rdata" and
"out.edges.Rdata",
which are the two components of the object "out", which was created
like
so:

out <- list(nodes = out.nodes, edges = out.edges)

And then finally just for your reference, I've included
"out.JSON.Rdata"
which contains the problematic output of the noquote(toJSON(out))
command.

Please let me know if you can reproduce the problem, and then what
your
thoughts on it are.

Thanks again,
Caitlin.

On Thu, Nov 6, 2014 at 4:04 PM, Alex Couture-Beil <
[email protected]>
wrote:

This doesn't show any of the behaviour described:

cat(toJSON(list(a="hello\u0004")))
{"a":"hello\u0004"}

cat(toJSON(c(a="hello\u0004")))
{"a":"hello\u0004"}


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).

from rjson.

caitiecollins avatar caitiecollins commented on August 18, 2024

Hi,

Yeah, the dummy data was not designed to be particularly nice, I just
copied the format I was using to generate my real data.
But at least now we know that your results don't look like mine!

Mine still look like this:
toJSON(out.nodes)
[{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]}]

While I hate to say something that will probably make me sound uninformed
if not genuinely stupid, what exactly do you mean by "buggy serialized
json"? If it's possible, for clarity's sake, could you provide me with a
line or two or code that I could use to debug this problem in a way that
would be useful to you and/or me?

Thanks,
Caitlin.

On Thu, Nov 6, 2014 at 7:57 PM, Alex Couture-Beil [email protected]
wrote:

Thanks for the sample code. I trimmed down the number of loops for the
dummy data.

I don't see any problems on my end:

{"nodes":[{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6},{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6}],"edges":[{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12}]}

Perhaps you could try working the reproduction case down to the smallest
amount of input data, and include the buggy serialized json as well.

Cheers

On Thu, Nov 6, 2014 at 11:19 AM, caitiecollins [email protected]
wrote:

Hi,

Sure, here is some dummy code to get the list type I have and the
bracketing problem I get when I run toJSON:

node <- list(1,2,3,4,5,6)
names(node) <- c("id", "label", "x", "y", "size", "color")

edge <- list(7,8,9,10,11,12)
names(edge) <- c("id", "source", "target", "color", "type", "size")

out.nodes <- list()
for(i in 1:20){
out.nodes[[i]] <- node
}

out.edges <- list()
for(i in 1:19){
out.edges[[i]] <- edge
}

out <- list(nodes= out.nodes, edges= out.edges)

out.JSON <- noquote(toJSON(out))

out.JSON

Can you copy and paste that and see if you get the same abundance of
square
brackets as I do in the resulting "out.JSON" object?

Thanks very much.

Cheers,
Caitlin.

On Thu, Nov 6, 2014 at 5:14 PM, Alex Couture-Beil <
[email protected]>
wrote:

Would you be able to produce an example that I can just copy and paste
into
R without having to load any external files please.

On Thu, Nov 6, 2014 at 8:20 AM, caitiecollins <
[email protected]>

wrote:

Hey,

Thanks for getting back to me so quickly!

If you have a second, can you take a look at these objects? They
were
the
ones partaking in the current problem.
The main file of interest is "out.Rdata", which when I use in the
line:

noquote(toJSON(out))

generates the object in JSON format with the problematic square
brackets.

The other files I'm including are "out.nodes.Rdata" and
"out.edges.Rdata",
which are the two components of the object "out", which was
created
like
so:

out <- list(nodes = out.nodes, edges = out.edges)

And then finally just for your reference, I've included
"out.JSON.Rdata"
which contains the problematic output of the noquote(toJSON(out))
command.

Please let me know if you can reproduce the problem, and then what
your
thoughts on it are.

Thanks again,
Caitlin.

On Thu, Nov 6, 2014 at 4:04 PM, Alex Couture-Beil <
[email protected]>
wrote:

This doesn't show any of the behaviour described:

cat(toJSON(list(a="hello\u0004")))
{"a":"hello\u0004"}

cat(toJSON(c(a="hello\u0004")))
{"a":"hello\u0004"}


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).

from rjson.

alexcb avatar alexcb commented on August 18, 2024

Serialized json is what toJSON returns. toJSON is a serializer which takes
data from R and serializes it to json format.
http://en.wikipedia.org/wiki/Serialization

When reporting (and debugging) a bug, it's best to get the smallest
possible reproduction case -- the smaller the input data, the easier it is
to see what's going wrong.

for example, take the following line (it's a single line of code I can copy
and paste, it's clear to understand what's going on -- no loops or external
data to load in)

noquote(toJSON(list(list(id=1, x=5), list(id=10, x=2))))

It gives me

[{"id":1,"x":5},{"id":10,"x":2}]

What does it give you?

On Fri, Nov 7, 2014 at 5:35 AM, caitiecollins [email protected]
wrote:

Hi,

Yeah, the dummy data was not designed to be particularly nice, I just
copied the format I was using to generate my real data.
But at least now we know that your results don't look like mine!

Mine still look like this:
toJSON(out.nodes)
[{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]}]

While I hate to say something that will probably make me sound uninformed
if not genuinely stupid, what exactly do you mean by "buggy serialized
json"? If it's possible, for clarity's sake, could you provide me with a
line or two or code that I could use to debug this problem in a way that
would be useful to you and/or me?

Thanks,
Caitlin.

On Thu, Nov 6, 2014 at 7:57 PM, Alex Couture-Beil <
[email protected]>
wrote:

Thanks for the sample code. I trimmed down the number of loops for the
dummy data.

I don't see any problems on my end:

{"nodes":[{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6},{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6}],"edges":[{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12}]}

Perhaps you could try working the reproduction case down to the smallest
amount of input data, and include the buggy serialized json as well.

Cheers

On Thu, Nov 6, 2014 at 11:19 AM, caitiecollins [email protected]

wrote:

Hi,

Sure, here is some dummy code to get the list type I have and the
bracketing problem I get when I run toJSON:

node <- list(1,2,3,4,5,6)
names(node) <- c("id", "label", "x", "y", "size", "color")

edge <- list(7,8,9,10,11,12)
names(edge) <- c("id", "source", "target", "color", "type", "size")

out.nodes <- list()
for(i in 1:20){
out.nodes[[i]] <- node
}

out.edges <- list()
for(i in 1:19){
out.edges[[i]] <- edge
}

out <- list(nodes= out.nodes, edges= out.edges)

out.JSON <- noquote(toJSON(out))

out.JSON

Can you copy and paste that and see if you get the same abundance of
square
brackets as I do in the resulting "out.JSON" object?

Thanks very much.

Cheers,
Caitlin.

On Thu, Nov 6, 2014 at 5:14 PM, Alex Couture-Beil <
[email protected]>
wrote:

Would you be able to produce an example that I can just copy and
paste
into
R without having to load any external files please.

On Thu, Nov 6, 2014 at 8:20 AM, caitiecollins <
[email protected]>

wrote:

Hey,

Thanks for getting back to me so quickly!

If you have a second, can you take a look at these objects? They
were
the
ones partaking in the current problem.
The main file of interest is "out.Rdata", which when I use in
the
line:

noquote(toJSON(out))

generates the object in JSON format with the problematic square
brackets.

The other files I'm including are "out.nodes.Rdata" and
"out.edges.Rdata",
which are the two components of the object "out", which was
created
like
so:

out <- list(nodes = out.nodes, edges = out.edges)

And then finally just for your reference, I've included
"out.JSON.Rdata"
which contains the problematic output of the noquote(toJSON(out))
command.

Please let me know if you can reproduce the problem, and then what
your
thoughts on it are.

Thanks again,
Caitlin.

On Thu, Nov 6, 2014 at 4:04 PM, Alex Couture-Beil <
[email protected]>
wrote:

This doesn't show any of the behaviour described:

cat(toJSON(list(a="hello\u0004")))
{"a":"hello\u0004"}

cat(toJSON(c(a="hello\u0004")))
{"a":"hello\u0004"}


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).

from rjson.

caitiecollins avatar caitiecollins commented on August 18, 2024

Hi,

Sorry, I was misinterpreting "buggy serialized json", reading it more as
"buggy-serialized" json, which was a concept I didn't understand, rather
than just the adjective "buggy" and "serialized json" as the subject.
Anyway, on to the more interesting topic of conversation, I get a different
result from you when I run that line of code!

Mine looks like this:

[{"id":[1],"x":[5]},{"id":[10],"x":[2]}]

Any thoughts on why that might be?

Thanks,
Caitlin.

On Fri, Nov 7, 2014 at 4:01 PM, Alex Couture-Beil [email protected]
wrote:

Serialized json is what toJSON returns. toJSON is a serializer which takes
data from R and serializes it to json format.
http://en.wikipedia.org/wiki/Serialization

When reporting (and debugging) a bug, it's best to get the smallest
possible reproduction case -- the smaller the input data, the easier it is
to see what's going wrong.

for example, take the following line (it's a single line of code I can
copy
and paste, it's clear to understand what's going on -- no loops or
external
data to load in)

noquote(toJSON(list(list(id=1, x=5), list(id=10, x=2))))

It gives me

[{"id":1,"x":5},{"id":10,"x":2}]

What does it give you?

On Fri, Nov 7, 2014 at 5:35 AM, caitiecollins [email protected]
wrote:

Hi,

Yeah, the dummy data was not designed to be particularly nice, I just
copied the format I was using to generate my real data.
But at least now we know that your results don't look like mine!

Mine still look like this:
toJSON(out.nodes)

[{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]}]

While I hate to say something that will probably make me sound
uninformed
if not genuinely stupid, what exactly do you mean by "buggy serialized
json"? If it's possible, for clarity's sake, could you provide me with a
line or two or code that I could use to debug this problem in a way that
would be useful to you and/or me?

Thanks,
Caitlin.

On Thu, Nov 6, 2014 at 7:57 PM, Alex Couture-Beil <
[email protected]>
wrote:

Thanks for the sample code. I trimmed down the number of loops for the
dummy data.

I don't see any problems on my end:

{"nodes":[{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6},{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6}],"edges":[{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12}]}

Perhaps you could try working the reproduction case down to the
smallest
amount of input data, and include the buggy serialized json as well.

Cheers

On Thu, Nov 6, 2014 at 11:19 AM, caitiecollins <
[email protected]>

wrote:

Hi,

Sure, here is some dummy code to get the list type I have and the
bracketing problem I get when I run toJSON:

node <- list(1,2,3,4,5,6)
names(node) <- c("id", "label", "x", "y", "size", "color")

edge <- list(7,8,9,10,11,12)
names(edge) <- c("id", "source", "target", "color", "type", "size")

out.nodes <- list()
for(i in 1:20){
out.nodes[[i]] <- node
}

out.edges <- list()
for(i in 1:19){
out.edges[[i]] <- edge
}

out <- list(nodes= out.nodes, edges= out.edges)

out.JSON <- noquote(toJSON(out))

out.JSON

Can you copy and paste that and see if you get the same abundance of
square
brackets as I do in the resulting "out.JSON" object?

Thanks very much.

Cheers,
Caitlin.

On Thu, Nov 6, 2014 at 5:14 PM, Alex Couture-Beil <
[email protected]>
wrote:

Would you be able to produce an example that I can just copy and
paste
into
R without having to load any external files please.

On Thu, Nov 6, 2014 at 8:20 AM, caitiecollins <
[email protected]>

wrote:

Hey,

Thanks for getting back to me so quickly!

If you have a second, can you take a look at these objects? They
were
the
ones partaking in the current problem.
The main file of interest is "out.Rdata", which when I use in
the
line:

noquote(toJSON(out))

generates the object in JSON format with the problematic square
brackets.

The other files I'm including are "out.nodes.Rdata" and
"out.edges.Rdata",
which are the two components of the object "out", which was
created
like
so:

out <- list(nodes = out.nodes, edges = out.edges)

And then finally just for your reference, I've included
"out.JSON.Rdata"
which contains the problematic output of the
noquote(toJSON(out))
command.

Please let me know if you can reproduce the problem, and then
what
your
thoughts on it are.

Thanks again,
Caitlin.

On Thu, Nov 6, 2014 at 4:04 PM, Alex Couture-Beil <
[email protected]>
wrote:

This doesn't show any of the behaviour described:

cat(toJSON(list(a="hello\u0004")))
{"a":"hello\u0004"}

cat(toJSON(c(a="hello\u0004")))
{"a":"hello\u0004"}


Reply to this email directly or view it on GitHub
<
https://github.com/alexcb/rjson/issues/5#issuecomment-62001759>.


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).

from rjson.

alexcb avatar alexcb commented on August 18, 2024

Excellent -- we made some progress :)

What version of rjson, R and Operating System are you using?

Can you send me the output of:

library(rjson); sessionInfo();

Thanks,
Alex

On Fri, Nov 7, 2014 at 8:11 AM, caitiecollins [email protected]
wrote:

Hi,

Sorry, I was misinterpreting "buggy serialized json", reading it more as
"buggy-serialized" json, which was a concept I didn't understand, rather
than just the adjective "buggy" and "serialized json" as the subject.
Anyway, on to the more interesting topic of conversation, I get a
different
result from you when I run that line of code!

Mine looks like this:

[{"id":[1],"x":[5]},{"id":[10],"x":[2]}]

Any thoughts on why that might be?

Thanks,
Caitlin.

On Fri, Nov 7, 2014 at 4:01 PM, Alex Couture-Beil <
[email protected]>
wrote:

Serialized json is what toJSON returns. toJSON is a serializer which
takes
data from R and serializes it to json format.
http://en.wikipedia.org/wiki/Serialization

When reporting (and debugging) a bug, it's best to get the smallest
possible reproduction case -- the smaller the input data, the easier it
is
to see what's going wrong.

for example, take the following line (it's a single line of code I can
copy
and paste, it's clear to understand what's going on -- no loops or
external
data to load in)

noquote(toJSON(list(list(id=1, x=5), list(id=10, x=2))))

It gives me

[{"id":1,"x":5},{"id":10,"x":2}]

What does it give you?

On Fri, Nov 7, 2014 at 5:35 AM, caitiecollins [email protected]

wrote:

Hi,

Yeah, the dummy data was not designed to be particularly nice, I just
copied the format I was using to generate my real data.
But at least now we know that your results don't look like mine!

Mine still look like this:
toJSON(out.nodes)

[{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]}]

While I hate to say something that will probably make me sound
uninformed
if not genuinely stupid, what exactly do you mean by "buggy serialized
json"? If it's possible, for clarity's sake, could you provide me with
a
line or two or code that I could use to debug this problem in a way
that
would be useful to you and/or me?

Thanks,
Caitlin.

On Thu, Nov 6, 2014 at 7:57 PM, Alex Couture-Beil <
[email protected]>
wrote:

Thanks for the sample code. I trimmed down the number of loops for
the
dummy data.

I don't see any problems on my end:

{"nodes":[{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6},{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6}],"edges":[{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12}]}

Perhaps you could try working the reproduction case down to the
smallest
amount of input data, and include the buggy serialized json as well.

Cheers

On Thu, Nov 6, 2014 at 11:19 AM, caitiecollins <
[email protected]>

wrote:

Hi,

Sure, here is some dummy code to get the list type I have and the
bracketing problem I get when I run toJSON:

node <- list(1,2,3,4,5,6)
names(node) <- c("id", "label", "x", "y", "size", "color")

edge <- list(7,8,9,10,11,12)
names(edge) <- c("id", "source", "target", "color", "type",
"size")

out.nodes <- list()
for(i in 1:20){
out.nodes[[i]] <- node
}

out.edges <- list()
for(i in 1:19){
out.edges[[i]] <- edge
}

out <- list(nodes= out.nodes, edges= out.edges)

out.JSON <- noquote(toJSON(out))

out.JSON

Can you copy and paste that and see if you get the same abundance
of
square
brackets as I do in the resulting "out.JSON" object?

Thanks very much.

Cheers,
Caitlin.

On Thu, Nov 6, 2014 at 5:14 PM, Alex Couture-Beil <
[email protected]>
wrote:

Would you be able to produce an example that I can just copy and
paste
into
R without having to load any external files please.

On Thu, Nov 6, 2014 at 8:20 AM, caitiecollins <
[email protected]>

wrote:

Hey,

Thanks for getting back to me so quickly!

If you have a second, can you take a look at these objects?
They
were
the
ones partaking in the current problem.
The main file of interest is "out.Rdata", which when I use
in
the
line:

noquote(toJSON(out))

generates the object in JSON format with the problematic
square
brackets.

The other files I'm including are "out.nodes.Rdata" and
"out.edges.Rdata",
which are the two components of the object "out", which was
created
like
so:

out <- list(nodes = out.nodes, edges = out.edges)

And then finally just for your reference, I've included
"out.JSON.Rdata"
which contains the problematic output of the
noquote(toJSON(out))
command.

Please let me know if you can reproduce the problem, and then
what
your
thoughts on it are.

Thanks again,
Caitlin.

On Thu, Nov 6, 2014 at 4:04 PM, Alex Couture-Beil <
[email protected]>
wrote:

This doesn't show any of the behaviour described:

cat(toJSON(list(a="hello\u0004")))
{"a":"hello\u0004"}

cat(toJSON(c(a="hello\u0004")))
{"a":"hello\u0004"}


Reply to this email directly or view it on GitHub
<
https://github.com/alexcb/rjson/issues/5#issuecomment-62001759>.


Reply to this email directly or view it on GitHub
<
https://github.com/alexcb/rjson/issues/5#issuecomment-62004626>.


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).

from rjson.

caitiecollins avatar caitiecollins commented on August 18, 2024

Oh good grief, I figured out what was going wrong. Turns out "nothing" is
the answer, with respect to your package.
One of the other packages I have been loading to run in conjunction with
yours has apparently updated itself to have as a dependency a package
called "jsonlite". You'll never guess what one of its functions is called...
Looks like after all I can solve this problem with a double colon.
Sorry if I wasted your time. You were very helpful, and it's been nice
talking to you. Thank you.

I wish you all the best,
Caitlin.

On Fri, Nov 7, 2014 at 5:36 PM, Alex Couture-Beil [email protected]
wrote:

Excellent -- we made some progress :)

What version of rjson, R and Operating System are you using?

Can you send me the output of:

library(rjson); sessionInfo();

Thanks,
Alex

On Fri, Nov 7, 2014 at 8:11 AM, caitiecollins [email protected]
wrote:

Hi,

Sorry, I was misinterpreting "buggy serialized json", reading it more as
"buggy-serialized" json, which was a concept I didn't understand, rather
than just the adjective "buggy" and "serialized json" as the subject.
Anyway, on to the more interesting topic of conversation, I get a
different
result from you when I run that line of code!

Mine looks like this:

[{"id":[1],"x":[5]},{"id":[10],"x":[2]}]

Any thoughts on why that might be?

Thanks,
Caitlin.

On Fri, Nov 7, 2014 at 4:01 PM, Alex Couture-Beil <
[email protected]>
wrote:

Serialized json is what toJSON returns. toJSON is a serializer which
takes
data from R and serializes it to json format.
http://en.wikipedia.org/wiki/Serialization

When reporting (and debugging) a bug, it's best to get the smallest
possible reproduction case -- the smaller the input data, the easier
it
is
to see what's going wrong.

for example, take the following line (it's a single line of code I can
copy
and paste, it's clear to understand what's going on -- no loops or
external
data to load in)

noquote(toJSON(list(list(id=1, x=5), list(id=10, x=2))))

It gives me

[{"id":1,"x":5},{"id":10,"x":2}]

What does it give you?

On Fri, Nov 7, 2014 at 5:35 AM, caitiecollins <
[email protected]>

wrote:

Hi,

Yeah, the dummy data was not designed to be particularly nice, I
just
copied the format I was using to generate my real data.
But at least now we know that your results don't look like mine!

Mine still look like this:
toJSON(out.nodes)

[{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]}]

While I hate to say something that will probably make me sound
uninformed
if not genuinely stupid, what exactly do you mean by "buggy
serialized
json"? If it's possible, for clarity's sake, could you provide me
with
a
line or two or code that I could use to debug this problem in a way
that
would be useful to you and/or me?

Thanks,
Caitlin.

On Thu, Nov 6, 2014 at 7:57 PM, Alex Couture-Beil <
[email protected]>
wrote:

Thanks for the sample code. I trimmed down the number of loops for
the
dummy data.

I don't see any problems on my end:

{"nodes":[{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6},{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6}],"edges":[{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12}]}

Perhaps you could try working the reproduction case down to the
smallest
amount of input data, and include the buggy serialized json as
well.

Cheers

On Thu, Nov 6, 2014 at 11:19 AM, caitiecollins <
[email protected]>

wrote:

Hi,

Sure, here is some dummy code to get the list type I have and
the
bracketing problem I get when I run toJSON:

node <- list(1,2,3,4,5,6)
names(node) <- c("id", "label", "x", "y", "size", "color")

edge <- list(7,8,9,10,11,12)
names(edge) <- c("id", "source", "target", "color", "type",
"size")

out.nodes <- list()
for(i in 1:20){
out.nodes[[i]] <- node
}

out.edges <- list()
for(i in 1:19){
out.edges[[i]] <- edge
}

out <- list(nodes= out.nodes, edges= out.edges)

out.JSON <- noquote(toJSON(out))

out.JSON

Can you copy and paste that and see if you get the same
abundance
of
square
brackets as I do in the resulting "out.JSON" object?

Thanks very much.

Cheers,
Caitlin.

On Thu, Nov 6, 2014 at 5:14 PM, Alex Couture-Beil <
[email protected]>
wrote:

Would you be able to produce an example that I can just copy
and
paste
into
R without having to load any external files please.

On Thu, Nov 6, 2014 at 8:20 AM, caitiecollins <
[email protected]>

wrote:

Hey,

Thanks for getting back to me so quickly!

If you have a second, can you take a look at these objects?
They
were
the
ones partaking in the current problem.
The main file of interest is "out.Rdata", which when I use
in
the
line:

noquote(toJSON(out))

generates the object in JSON format with the problematic
square
brackets.

The other files I'm including are "out.nodes.Rdata" and
"out.edges.Rdata",
which are the two components of the object "out", which
was
created
like
so:

out <- list(nodes = out.nodes, edges = out.edges)

And then finally just for your reference, I've included
"out.JSON.Rdata"
which contains the problematic output of the
noquote(toJSON(out))
command.

Please let me know if you can reproduce the problem, and
then
what
your
thoughts on it are.

Thanks again,
Caitlin.

On Thu, Nov 6, 2014 at 4:04 PM, Alex Couture-Beil <
[email protected]>
wrote:

This doesn't show any of the behaviour described:

cat(toJSON(list(a="hello\u0004")))
{"a":"hello\u0004"}

cat(toJSON(c(a="hello\u0004")))
{"a":"hello\u0004"}


Reply to this email directly or view it on GitHub
<
https://github.com/alexcb/rjson/issues/5#issuecomment-62001759>.


Reply to this email directly or view it on GitHub
<
https://github.com/alexcb/rjson/issues/5#issuecomment-62004626>.


Reply to this email directly or view it on GitHub
<
https://github.com/alexcb/rjson/issues/5#issuecomment-62014961>.


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).

from rjson.

alexcb avatar alexcb commented on August 18, 2024

Glad it all worked out.

On Fri, Nov 7, 2014 at 9:55 AM, caitiecollins [email protected]
wrote:

Oh good grief, I figured out what was going wrong. Turns out "nothing" is
the answer, with respect to your package.
One of the other packages I have been loading to run in conjunction with
yours has apparently updated itself to have as a dependency a package
called "jsonlite". You'll never guess what one of its functions is
called...
Looks like after all I can solve this problem with a double colon.
Sorry if I wasted your time. You were very helpful, and it's been nice
talking to you. Thank you.

I wish you all the best,
Caitlin.

On Fri, Nov 7, 2014 at 5:36 PM, Alex Couture-Beil <
[email protected]>
wrote:

Excellent -- we made some progress :)

What version of rjson, R and Operating System are you using?

Can you send me the output of:

library(rjson); sessionInfo();

Thanks,
Alex

On Fri, Nov 7, 2014 at 8:11 AM, caitiecollins [email protected]

wrote:

Hi,

Sorry, I was misinterpreting "buggy serialized json", reading it more
as
"buggy-serialized" json, which was a concept I didn't understand,
rather
than just the adjective "buggy" and "serialized json" as the subject.
Anyway, on to the more interesting topic of conversation, I get a
different
result from you when I run that line of code!

Mine looks like this:

[{"id":[1],"x":[5]},{"id":[10],"x":[2]}]

Any thoughts on why that might be?

Thanks,
Caitlin.

On Fri, Nov 7, 2014 at 4:01 PM, Alex Couture-Beil <
[email protected]>
wrote:

Serialized json is what toJSON returns. toJSON is a serializer which
takes
data from R and serializes it to json format.
http://en.wikipedia.org/wiki/Serialization

When reporting (and debugging) a bug, it's best to get the smallest
possible reproduction case -- the smaller the input data, the easier
it
is
to see what's going wrong.

for example, take the following line (it's a single line of code I
can
copy
and paste, it's clear to understand what's going on -- no loops or
external
data to load in)

noquote(toJSON(list(list(id=1, x=5), list(id=10, x=2))))

It gives me

[{"id":1,"x":5},{"id":10,"x":2}]

What does it give you?

On Fri, Nov 7, 2014 at 5:35 AM, caitiecollins <
[email protected]>

wrote:

Hi,

Yeah, the dummy data was not designed to be particularly nice, I
just
copied the format I was using to generate my real data.
But at least now we know that your results don't look like mine!

Mine still look like this:
toJSON(out.nodes)

[{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]},{"id":[1],"label":[2],"x":[3],"y":[4],"size":[5],"color":[6]}]

While I hate to say something that will probably make me sound
uninformed
if not genuinely stupid, what exactly do you mean by "buggy
serialized
json"? If it's possible, for clarity's sake, could you provide me
with
a
line or two or code that I could use to debug this problem in a
way
that
would be useful to you and/or me?

Thanks,
Caitlin.

On Thu, Nov 6, 2014 at 7:57 PM, Alex Couture-Beil <
[email protected]>
wrote:

Thanks for the sample code. I trimmed down the number of loops
for
the
dummy data.

I don't see any problems on my end:

{"nodes":[{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6},{"id":1,"label":2,"x":3,"y":4,"size":5,"color":6}],"edges":[{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12},{"id":7,"source":8,"target":9,"color":10,"type":11,"size":12}]}

Perhaps you could try working the reproduction case down to the
smallest
amount of input data, and include the buggy serialized json as
well.

Cheers

On Thu, Nov 6, 2014 at 11:19 AM, caitiecollins <
[email protected]>

wrote:

Hi,

Sure, here is some dummy code to get the list type I have and
the
bracketing problem I get when I run toJSON:

node <- list(1,2,3,4,5,6)
names(node) <- c("id", "label", "x", "y", "size", "color")

edge <- list(7,8,9,10,11,12)
names(edge) <- c("id", "source", "target", "color", "type",
"size")

out.nodes <- list()
for(i in 1:20){
out.nodes[[i]] <- node
}

out.edges <- list()
for(i in 1:19){
out.edges[[i]] <- edge
}

out <- list(nodes= out.nodes, edges= out.edges)

out.JSON <- noquote(toJSON(out))

out.JSON

Can you copy and paste that and see if you get the same
abundance
of
square
brackets as I do in the resulting "out.JSON" object?

Thanks very much.

Cheers,
Caitlin.

On Thu, Nov 6, 2014 at 5:14 PM, Alex Couture-Beil <
[email protected]>
wrote:

Would you be able to produce an example that I can just copy
and
paste
into
R without having to load any external files please.

On Thu, Nov 6, 2014 at 8:20 AM, caitiecollins <
[email protected]>

wrote:

Hey,

Thanks for getting back to me so quickly!

If you have a second, can you take a look at these
objects?
They
were
the
ones partaking in the current problem.
The main file of interest is "out.Rdata", which when I
use
in
the
line:

noquote(toJSON(out))

generates the object in JSON format with the problematic
square
brackets.

The other files I'm including are "out.nodes.Rdata" and
"out.edges.Rdata",
which are the two components of the object "out", which
was
created
like
so:

out <- list(nodes = out.nodes, edges = out.edges)

And then finally just for your reference, I've included
"out.JSON.Rdata"
which contains the problematic output of the
noquote(toJSON(out))
command.

Please let me know if you can reproduce the problem, and
then
what
your
thoughts on it are.

Thanks again,
Caitlin.

On Thu, Nov 6, 2014 at 4:04 PM, Alex Couture-Beil <
[email protected]>
wrote:

This doesn't show any of the behaviour described:

cat(toJSON(list(a="hello\u0004")))
{"a":"hello\u0004"}

cat(toJSON(c(a="hello\u0004")))
{"a":"hello\u0004"}


Reply to this email directly or view it on GitHub
<
https://github.com/alexcb/rjson/issues/5#issuecomment-62001759>.


Reply to this email directly or view it on GitHub
<
https://github.com/alexcb/rjson/issues/5#issuecomment-62004626>.


Reply to this email directly or view it on GitHub
<
https://github.com/alexcb/rjson/issues/5#issuecomment-62014961>.


Reply to this email directly or view it on GitHub
<
https://github.com/alexcb/rjson/issues/5#issuecomment-62034938>.


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).


Reply to this email directly or view it on GitHub
#5 (comment).

from rjson.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.