Handy Json Object Editor
Moderators: dorpond, trevor, Azhrei, Gamerdude
- PyroMancer2k
- Dragon
- Posts: 925
- Joined: Thu Sep 11, 2008 2:04 pm
Handy Json Object Editor
UPDATE: New Json Object Editor Token
The old token has a bit of a limit in that it can only get Json nested one layer deep. That is to say if you have a Json inside a Json. But if you have a Json inside a Json inside a Json and so on then it won't work. It also assumed that all layers were the same depth. The new editor tool allows you to edit Json objects regardless of how deep the Json tree goes.
Below is an example of it editing different types of Json Objects and Arrays as well as different levels of nesting
I tested it on some small scale Json objects including those in some of the default campaign frameworks and it seems to work just fine. If you find any bugs with it though let me know.
Json Editor2 Campaign
http://rapidshare.com/files/226608361/j ... 2v04.cmpgn
Json Editor2 Token
http://rapidshare.com/files/226611102/J ... 2_04.rptok
Also this is a completely new token so if you are working with simple Json Objects and prefer the old format I left the original post and token links below.
--- ORIGINAL POST ---
I've been messing around with the new json objects in order to learn how to use them and in the style of my handy StrProp Editor I made something similar for json Objects.
The Lib:Token does all the work and all you need to do is use the json Editor Call macro which can be copied to any token or put into the campaign macros. It checks all properties on the token to see which ones are json and then gives you a list. The prop depends on what type of json it is list shown below.
You will get either the Json or Array Setup depending on which they of json the property is. If you have a json Nested inside another json then you will get the JsonNested window. For nested json you will get either of the 2 input() prompts shown depending on which type it is. For the first two you will get a standard single entry prompt.
Given that json are fairly new I figured it would be handy to have an easy way to edit them as well as some nice code to look at that is able to handle managing them in a few ways.
Here is the campaign
http://gallery.rptools.net/d/33926-1/js ... ff914aea22
Just the Lib:Token
http://gallery.rptools.net/d/33981-1/js ... ff914aea22
Alt Download Site
Campaign
http://www.savefile.com/files/1996067
Token
http://www.savefile.com/files/1996071
The old token has a bit of a limit in that it can only get Json nested one layer deep. That is to say if you have a Json inside a Json. But if you have a Json inside a Json inside a Json and so on then it won't work. It also assumed that all layers were the same depth. The new editor tool allows you to edit Json objects regardless of how deep the Json tree goes.
Below is an example of it editing different types of Json Objects and Arrays as well as different levels of nesting
I tested it on some small scale Json objects including those in some of the default campaign frameworks and it seems to work just fine. If you find any bugs with it though let me know.
Json Editor2 Campaign
http://rapidshare.com/files/226608361/j ... 2v04.cmpgn
Json Editor2 Token
http://rapidshare.com/files/226611102/J ... 2_04.rptok
Also this is a completely new token so if you are working with simple Json Objects and prefer the old format I left the original post and token links below.
--- ORIGINAL POST ---
I've been messing around with the new json objects in order to learn how to use them and in the style of my handy StrProp Editor I made something similar for json Objects.
The Lib:Token does all the work and all you need to do is use the json Editor Call macro which can be copied to any token or put into the campaign macros. It checks all properties on the token to see which ones are json and then gives you a list. The prop depends on what type of json it is list shown below.
You will get either the Json or Array Setup depending on which they of json the property is. If you have a json Nested inside another json then you will get the JsonNested window. For nested json you will get either of the 2 input() prompts shown depending on which type it is. For the first two you will get a standard single entry prompt.
Given that json are fairly new I figured it would be handy to have an easy way to edit them as well as some nice code to look at that is able to handle managing them in a few ways.
Here is the campaign
http://gallery.rptools.net/d/33926-1/js ... ff914aea22
Just the Lib:Token
http://gallery.rptools.net/d/33981-1/js ... ff914aea22
Alt Download Site
Campaign
http://www.savefile.com/files/1996067
Token
http://www.savefile.com/files/1996071
Last edited by PyroMancer2k on Tue Apr 28, 2009 2:17 am, edited 3 times in total.
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: Handy Json Object Editor
Maybe something nifty like this should be hard-coded into MT?
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: Handy Json Object Editor
Cool. This should be handy for playing around a bit.
I don't suppose you could just export the token or the macro, eh? Loading a campaign in order to save a couple of macros seems a bit ... overkill?
I don't suppose you could just export the token or the macro, eh? Loading a campaign in order to save a couple of macros seems a bit ... overkill?
- PyroMancer2k
- Dragon
- Posts: 925
- Joined: Thu Sep 11, 2008 2:04 pm
Re: Handy Json Object Editor
Ok done . I know some people still new to the whole Lib:Token concept so I figured I'd put in a campaign where it was already setup. That way people could see it in action real quick without needed to make their own token with json objects on it since it edits other tokens not itself .Azhrei wrote:Cool. This should be handy for playing around a bit.
I don't suppose you could just export the token or the macro, eh? Loading a campaign in order to save a couple of macros seems a bit ... overkill?
Re: Handy Json Object Editor
Pyro, when you get a chance, can you post this up somewhere else? The gallery is down and I could really use this little tool. I'd rather not reinvent the wheel, since you've done all this nice work!
Re: Handy Json Object Editor
Trevor was going to work on uploading all of the gallery stuff again once b50 was out. So it should be online again soon. I'm sure he'll post a News item on the new site when it's back up.
Re: Handy Json Object Editor
Bummer. The downloads seem to be corrupted, now that the gallery is back online.
- PyroMancer2k
- Dragon
- Posts: 925
- Joined: Thu Sep 11, 2008 2:04 pm
Re: Handy Json Object Editor
That sucks.Rumble wrote:Bummer. The downloads seem to be corrupted, now that the gallery is back online.
Anyhow I put the files up on another site.
Campaign
http://www.savefile.com/files/1996067
Token
http://www.savefile.com/files/1996071
Re: Handy Json Object Editor
PyroMancer2k wrote:That sucks.Rumble wrote:Bummer. The downloads seem to be corrupted, now that the gallery is back online.
Anyhow I put the files up on another site.
Campaign
http://www.savefile.com/files/1996067
Token
http://www.savefile.com/files/1996071
Coolitude. Thanks! (I made one in the interim, but it's specific to one particular JSON property, rather than a general solution).
Re: Handy Json Object Editor
Edit1: Never mind. I'm seeing the problem with Pyro's campaign file.
Edit2: The ZIP file is corrupted. I don't see any obvious problem such as text download that should've been binary. Those types of issues usually leave telltale signs that don't appear in this file.
It might have had something to do with him having to download everything to move it to the new site, but I can't imagine ZIP files being downloaded as text instead of binary?!
Edit2: The ZIP file is corrupted. I don't see any obvious problem such as text download that should've been binary. Those types of issues usually leave telltale signs that don't appear in this file.
Can you provide a specific example? I'll take a look into it.Rumble wrote:Bummer. The downloads seem to be corrupted, now that the gallery is back online.
It might have had something to do with him having to download everything to move it to the new site, but I can't imagine ZIP files being downloaded as text instead of binary?!
Re: Handy Json Object Editor
Out of curiosity, what happened? I have the same problem with any campaign file I've tried to download from the gallery (I posted about this in the b50 release thread, too).Azhrei wrote:Edit1: Never mind. I'm seeing the problem with Pyro's campaign file.
Edit2: The ZIP file is corrupted. I don't see any obvious problem such as text download that should've been binary. Those types of issues usually leave telltale signs that don't appear in this file.
Re: Handy Json Object Editor
No idea. It probably had something to do with the files being downloaded to Trevor's machine and then back up again. Probably a glitch during that process...
- PyroMancer2k
- Dragon
- Posts: 925
- Joined: Thu Sep 11, 2008 2:04 pm
Re: Handy Json Object Editor
I decided to post the reply here so as to not derail my Token thread to much .
Also I wanted to do something like that for my new Inventory System with JSON objects. If you play around with my consumables Inventory editors you'll notice you can add types of consumables and new properties to them as well and all the consumables editing/use macros still work on them. The problem with that kind of overhaul to my token inventory setup is that it will mean replacing nearly every single macro on the token because most have to get the equipment stats.
However first when I get the time I wanna learn most of the new functions on MT cause they will no doubt make setting up a new better JSON editor a lot easier.
I could look into it but not for at least about 2 weeks. Gotta gets things together this weekend and then I will be gone all next week. Followed by some major crunch time the following week in order to catch up. And I'd also probably redesign the interface since adding new items requires a bit extra. I just through the editor together when JSON objects first came out as a quick debug tool as well as a way to test and demonstrate using them.jfrazierjr wrote: If you can spare the time, something that would be AWESOME is if your JSON editor could have a branch for creating new JSON objects. Perhaps a checkbox and combobox with "how many items to add" which opens a new window when submitted
that allows entering the keys. Then when that is submitted, another window comes up to edit the values for those keys.
Also I wanted to do something like that for my new Inventory System with JSON objects. If you play around with my consumables Inventory editors you'll notice you can add types of consumables and new properties to them as well and all the consumables editing/use macros still work on them. The problem with that kind of overhaul to my token inventory setup is that it will mean replacing nearly every single macro on the token because most have to get the equipment stats.
However first when I get the time I wanna learn most of the new functions on MT cause they will no doubt make setting up a new better JSON editor a lot easier.
Re: Handy Json Object Editor
Played around with it a bit. It's helping me understand a bit of how these things work.
Is there a way to set it up to deal with nested arrays. Looking at a power array for Mutants&Masterminds. I would end up looking at something like PowerName then everything that effects the whole power/group of powers then an array of powers with feats and other modifiers for each. An add array function would be great as well..
Is there a way to set it up to deal with nested arrays. Looking at a power array for Mutants&Masterminds. I would end up looking at something like PowerName then everything that effects the whole power/group of powers then an array of powers with feats and other modifiers for each. An add array function would be great as well..
- PyroMancer2k
- Dragon
- Posts: 925
- Joined: Thu Sep 11, 2008 2:04 pm
Re: Handy Json Object Editor
Well it should allow you to edit nested arrays and nest Json objects. But that is it only allows you to "edit" them not to "add/remove" items from them. Unless I'm misunderstanding what your asking for. If so please include some screenshots or some code which shows how the nested array is setup. If it's a nested nested array my token it's really setup to handle that. I choose to only handle one layer deep in the interest of ease and if I understand the JSON object setup correctly there is no limit to how deep you can take the nesting.Miar wrote:Played around with it a bit. It's helping me understand a bit of how these things work.
Is there a way to set it up to deal with nested arrays. Looking at a power array for Mutants&Masterminds. I would end up looking at something like PowerName then everything that effects the whole power/group of powers then an array of powers with feats and other modifiers for each. An add array function would be great as well..
There was a request for the add new items feature but I think it may take a bit of time to do. I've been rather busy lately so haven't had much time to work on things in MT. I made this tool a while back to help understand how JSON objects work as well as experiment with their potential as a new data structure for my inventory system. With little time to work on it and some further experiments which I didn't release seem to indicate that StrProps actually handled faster. But in one of the more recent MT updates it mentioned JSON objects were set to handle more efficiently so when I ran those macros again it was noticeable that JSON were running faster. The macros I ran for "speed" test had few hundred items with few hundred loops. So you probably wouldn't notice in standard macro but I needed that many since it was for inventory system which might have that many items.
There is also a Handy StrProp Editor thread also which does the same thing as this for StrProps. My current token's inventory system is setup based on StrProps which is why I made it.
Hopefully I'll get some spare time soon and this tool will be at the top of my list for things to work on. Mainly because I wanna learn a lot more about JSON objects before updating my token .