Skip to content

Instantly share code, notes, and snippets.

@wactbprot
Created June 14, 2011 19:35
Show Gist options
  • Save wactbprot/1025675 to your computer and use it in GitHub Desktop.
Save wactbprot/1025675 to your computer and use it in GitHub Desktop.
R JSON isomorphism implemented by RJSONIO v0.7-2 & v0.7-3
digraph g {
size="46.8,33.2!" landscape=false
overlap=false splines=true
label="RJSONIO \nv0.7-2 & v0.7-3"
graph [
rankdir = "LR"
];
node [
fontsize = "12"
fontname=Helvetica
];
edge [
];
"R1" [
label = "<f0> R (empty list) | <f1> a \<- list()"
shape = "record"
];
"RJ1" [
label = "<f0> toJSON | <f1> b \<- toJSON(a)| <f2> a:\n\"\[\]\""
shape = "record"
];
"JR1" [
label = "<f0> fromJSON | <f1>c \<-fromJSON(b)| <f2>c:\n list()"
shape = "record"
];
"R1":f0 -> "RJ1":f0 [];
"RJ1":f0 -> "JR1":f0 [];
"JR1":f1 -> "R1":f1 [color="darkgreen" label="ok"];
// ______________________________
"R2" [
label = "<f0> R (string value) | <f1> a \<- list(i=\"k\")"
shape = "record"
];
"RJ2" [
label = "<f0> toJSON | <f1> b \<- toJSON(a)| <f2> b:\n \"\{\"i\": \"k\" \}\" "
shape = "record"
];
"JR2" [
label = "<f0> fromJSON | <f1>c \<-fromJSON(b)| <f2>c:\n $i\n[1] \"k\""
shape = "record"
];
"R2":f0 -> "RJ2":f0 [];
"RJ2":f0 -> "JR2":f0 [];
"JR2":f1 -> "R2":f1 [color="darkgreen" label="ok"];
// ______________________________
"R3" [
label = "<f0> R (single numeric value) | <f1> a \<- list(i=1)"
shape = "record"
];
"RJ3" [
label = "<f0> toJSON | <f1> b \<- toJSON(a)| <f2> b:\n \"\{\"i\": 1 \}\" "
shape = "record"
];
"JR3" [
label = "<f0> fromJSON | <f1>c \<-fromJSON(b)| <f2>c:\n i\n 1\n"
shape = "record"
];
"R3":f0 -> "RJ3":f0 [];
"RJ3":f0 -> "JR3":f0 [];
"JR3":f1 -> "R3":f1 [color="red"label="is.list(c)\n[1] FALSE"];
// ______________________________
"R4" [
label = "<f0> R (single numeric vector) | <f1> a \<- list(i=c(1,2)"
shape = "record"
];
"RJ4" [
label = "<f0> toJSON | <f1> b \<- toJSON(a)| <f2> b:\n \"\{\"i\": [ 1, 2 ]\}\" "
shape = "record"
];
"JR4" [
label = "<f0> fromJSON | <f1>c \<-fromJSON(b)| <f2>c:\n $i\n[1] 1 2\n"
shape = "record"
];
"R4":f0 -> "RJ4":f0 [];
"RJ4":f0 -> "JR4":f0 [];
"JR4":f1 -> "R4":f1 [color="darkgreen" label="ok"];
// ______________________________
"R5" [
label = "<f0> R (NULL list) | <f1> a \<- list(i=NULL)"
shape = "record"
];
"RJ5" [
label = "<f0> toJSON | <f1> b \<- toJSON(a)| <f2> a:\n\"\{ \"i\": null \}\""
shape = "record"
];
"JR5" [
label = "<f0> fromJSON | <f1>c \<-fromJSON(b)| <f2>c:\n$i\n[1] NULL"
shape = "record"
];
"R5":f0 -> "RJ5":f0 [];
"RJ5":f0 -> "JR5":f0 [];
"JR5":f1 -> "R5":f1 [color="darkgreen" label="ok"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment