[plugin] JSON (import/export/generate/edit/inspect/...)

Post your work in progress addons and get feedback

Post » Mon May 04, 2015 1:07 pm

@CrazyVulcan
As big as your browser/device can handle (:
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

Post » Thu Aug 20, 2015 5:04 am

This plugin was exactly what I needed. Great job. Thank you!
B
12
S
4
Posts: 48
Reputation: 910

Post » Sun Aug 30, 2015 9:39 pm

Hi,
I updated to Construct2 212.2 and have now troubles using the pluging. Am I'm the only one?

Error:
Unable to load behavior in "C:\Program Files\Construct2\exporters\html5\behavior\json-v1.1\": Javascript exception in file "edittime.js" line 65: RefernceError: AddVariadicParams is not defined

Code line:
AddVariadicParams("Key{n},"Key or index to get the value. If no key is

Stack trace:
ReferenceError: AddVariadicParams is not defined
at keyPath(edittime.js:65:5)
at edittime.js:76:1

This behavior will not be available in the editor
B
15
S
4
Posts: 77
Reputation: 1,030

Post » Mon Aug 31, 2015 12:12 am

Hmmm...
@edwardr
Are you sure you didn't do more than just updating?
'cause, I already see something wrong here:
C:\Program Files\Construct2\exporters\html5\behavior\json-v1.1

the .js and .ico files of the plugin are supposed to go in
C:\Program Files\Construct2\exporters\html5\plugins\json\
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

Post » Mon Aug 31, 2015 9:25 am

I tried it in plugins, but it doesn't appeared. Then I put in behavior, there comes the error.

But anyway I got some additional other errors, so I deinstalled Construct and installed it again. Now everything is fine, it seems something went wrong during the last Installation.

sorry for the worries I caused.
B
15
S
4
Posts: 77
Reputation: 1,030

Post » Wed Sep 30, 2015 11:18 am

It's me again :)
I just need a small re-thinking or tips to reduce some programing. It's working but it's really "dirty" and I'm not so happy about it and maybe it will get complicated if I make some changes in the future

Situation:
I have several databases, which stands for each research category and in each database there are several upgrades with their specific requirements. So if you click an Overview-Icon the specific database will be loaded, the actual upgrade level will be shown and you can research the next level.

Code: Select all
Database - Weapon
new Object at root@
Set Current Path to [email protected]
Set "1st Upgrade" at current@"Text"
Set 100 at current@"Time"
Set 400 at current@"Price"
Set "Image1" at current@"Image"

Set Current Path to [email protected]
Set "2st Upgrade" at current@"Text"
Set 120 at current@"Time"
Set 420 at current@"Price"
Set "Image2" at current@"Image"[/


This works, BUT...
for each category I have to copy the programming but with other database-name and then I also have so many json files.
a simple version: http://1drv.ms/1O7unzm

Is there a possibility to reduce it in one database?

When I click an image, I pass with function() the parameters, so I need just one programming and one database. I need something like an over-root? (The root name should be a number, so I just can add or substract by 1 and jump so through the level)

e.g.
Weapon_Json.value(0,1,"Description") -> All_Json.Value("Weapon",1,"Description")
(in Detail:
All_Json.Value(Function.Param(0),Variable1,"Description") function.param(0) stands for the Paramater which is passed trough and variable1 the current level (e.g.))
B
15
S
4
Posts: 77
Reputation: 1,030

Post » Wed Sep 30, 2015 1:58 pm

ok, I'm coming closer. I found a mistake and corrected it. Now it makes a loop and search the specific datas, but it loops endless... ???

I updated the sample: http://1drv.ms/1O7unzm
B
15
S
4
Posts: 77
Reputation: 1,030

Post » Fri Oct 23, 2015 1:44 pm

@Yann How can I add values to the array? There is an action to add an empty array, but now way to add/remove values to it.

Edit: OK, found it out, you can set new values by specifying the array index as the second parameter in SetValue function. Push/Pop would be very helpful, though.
B
45
S
11
G
4
Posts: 515
Reputation: 7,389

Post » Sat Oct 24, 2015 7:29 pm

@Yann , You can't seem to create a loop inside another loop. How can I do this?


edit: nevermind, I managed to do it with a call to a function.. This now allows me to loop through any nested objects however many levels deep.
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Thu Jan 21, 2016 9:07 am

Hi there,

I would like to create a json structure like this:
{
"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter","lastName":"Jones"}
]
}

There is an array of employees. I'm stuck creating this array.

Any help will be appreciated.

Thanks
Last edited by esfand55 on Thu Jan 21, 2016 11:14 am, edited 2 times in total.
B
3
Posts: 1
Reputation: 177

PreviousNext

Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 1 guest