How to load JSON File in a Model?

Notice: This thread is very old.
thundervoice
Member | 10
+
0
-

Hello Guys

How i can load a JSON File in a Model?

Something like this:

File structure:
/app/config
/app/forms
/app/model
/app/model/json
/app/model/json/item_group.json

public function getGroup(){
	$groups= \file_get_contents("../../json/item_group.json");
	$groups= \json_decode($groups, true);

	return $groups;
}
harmim
Member | 26
+
0
-

This doesn´t work? If you want, you can use methods from Nette\Utils\Json class.

Perhaps would be better move data from item_group.json somewhere to NEON config files and read it from there.