I am using imagick to get a number of pages and save it to json. But I store the number as is: for example - 20. I need to store the number with a key like this:
{
"pages": "20"
}
Here is the code example, that I have. $json - just a path to a created json file. $num - number of pages.
Storage::put(($json), $num);
Should I creat json first, and then somehow add key to a number and encode file?