JSON support?

Hi,

is there JSON support in Scripycase?
In other word how can i present data from a JSON formatted field into normal field layout?

Regards
Erwin

Just plain php, it has everything you need.

http://php.net/manual/en/function.json-decode.php

i.e.

$string = ā€˜{ā€œfirstnameā€: ā€œJohnā€, ā€œlastnameā€: ā€œDoeā€}ā€™; //thatā€™s your JSON string

$myarray = json_decode($string, true); //create an associative array
{first_name} = $myarray[ā€˜firstnameā€™];
{last_name} = $myarray[ā€˜lastnameā€™];

Thatā€™s it.

jsb

Thank you, and how can i prsent this in a gridview?
Sorry, iā€™m rather new to scriptcase.

[QUOTE=etsoft;31804]Thank you, and how can i prsent this in a gridview?
Sorry, iā€™m rather new to scriptcase.[/QUOTE]

You canā€™t. Grids feeds from database.

[QUOTE=etsoft;31804]Thank you, and how can i prsent this in a gridview?
Sorry, iā€™m rather new to scriptcase.[/QUOTE]

Create a table according to your json data and base a grid on it.
Load the array into the table.
Voila!

jsb

PS: Damn Giu, 3 minutes. :-o

Still, if there are more users this solution is too simple. You need to create a temporary table and/or use some info to match the user.

[QUOTE=jsbinca;31807]Create a table according to your json data and base a grid on it.
Load the array into the table.
Voila!

jsb

PS: Damn Giu, 3 minutes. :-o[/QUOTE]

Well, your answer is more complete :wink:

[QUOTE=jsbinca;31807]Create a table according to your json data and base a grid on it.
Load the array into the table.
Voila!

jsb

PS: Damn Giu, 3 minutes. :-o[/QUOTE]

so shall we parse our Json string and insert to a mysql table and use the table in grid application?

Yes. AS I mentioned Grid apps feeds from an SQL. For this reason if you receive this data on JSON format, you need to pass it to a table, and feed grid from there.

Can we get a grid that loads json arrays like Kendo grid does ?

1 Like