FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

JSON indentation

 
Post new topic   Reply to topic     Forum Index -> Doost
View previous topic :: View next topic  
Author Message
baxissimo



Joined: 23 Oct 2006
Posts: 241
Location: Tokyo, Japan

PostPosted: Mon Jun 23, 2008 3:05 am    Post subject: JSON indentation Reply with quote

The JSON output, comes out looking like:
Code:

[{
"Container" : {
"thing_" : {
"Thingy" : {
"n_parts" : 4,
"name" : "ImaThingy",
"bytes" : [0, 1, 2, 3]
}
}
}
}, {
"Container" : {
"thing_" : $1
}
}]


without any indentation whatsoever. It looks like there's some infrastructure there intended to make indentations, but currently 'indent' is always 0, and Skip.indent is never used. How hard would it be to make that work?

As a first step in using the Serializer I'd like to replace my code that I have that saves a simple Prefs struct to JSON. But my current code (using cashew's JSON utils) indents nicely. I don't really want my prefs file to take a step backwards by "upgrading" to doost.serialize.
Back to top
View user's profile Send private message
aarti_pl



Joined: 25 Jul 2006
Posts: 28

PostPosted: Tue Jun 24, 2008 4:20 pm    Post subject: Reply with quote

It's difficult to say how much work it will take. Probably not so much, but I can not give any timing, when I will be able to implement this.
Back to top
View user's profile Send private message
baxissimo



Joined: 23 Oct 2006
Posts: 241
Location: Tokyo, Japan

PostPosted: Tue Jun 24, 2008 11:50 pm    Post subject: Reply with quote

aarti_pl wrote:
It's difficult to say how much work it will take. Probably not so much, but I can not give any timing, when I will be able to implement this.


I took care of this one. Now output looks like this:

Code:

[{
    "Container" : {
        "thing_" : {
            "Thingy" : {
                "n_parts" : 4,
                "name" : "ImaThingy",
                "dict" : {
                    5 : 0.5,
                    7 : 0.7,
                    9 : 0.9
                },
                "bytes" : [0, 1, 2, 3]
            }
        }
    }
}, {
    "Container" : {
        "thing_" : $1
    }
}]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Doost All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group