@oricatmos said:
@myhand said:
Thanks OricAtmos! Will give it a try.
Did you get it to work? Unfortunately I've been unsuccessful in finding out where I got it from.
Sorry, I got a bit tied up with trying to solve the MAC bug in my Material_Maintenance Plugin.
Thank you, I have now got it to not throw an error, but my test code does not seem to serialise objects, so will need to read the library docs to see what I am doing wrong
` require 'yajl'
h = {"key1", "val1", "key2", "val2"};
obj = ["Hello", "world", "I am here", ["where", "what", "are", "you"]];
class TestClass
@name = nil;
@adress = nil;
@list = nil;
def initialize(p1, p2)
@name, @adress = p1, p2;
@list = [1,2,3.01,-4.35];
end
end
t = TestClass.new("Richo", "37 Scotland Rd, Buckhurst Hill, IG9 5NP");
obj = ["Hello", "world", t, "I am here", ["where", "what", "are", "you"]];
str = Yajl::Encoder.encode(obj);
puts str;`
Produces
["Hello","world","#<TestClass;0x144d9cc0>","I am here",["where","what","are","you"]]
Instead of the
["Hello","world",{"@list";[1,2,3.01,-4.35],"@name";"Richo","@adress";"37 Scotland Rd, Buckhurst Hill, IG9 5NP"},"I am here",["where","what","are","you"]]
I would expect and which is what my simple JSON Serializer produces.