HI,
I’ve successfully set up my API and can retrieve JSON data. However, I need guidance on parsing this JSON data through a PHP function to sort and process it efficiently.
Specifically, I have a custom WordPress hook to manipulate this JSON data (e.g., sorting). Currently, my setup involves fetching the JSON directly using the endpoint URL in my php function. However, I’d like to leverage the new API features, particularly for caching and other optimizations.
Can I pass the JSON data as a parameter to my custom hook?
So i set up the API and consume - then create a inner provider for my custom hook where i add a JSON param for the data being fed in by the API e.g.
{
"jsonfromapi": "{outputted json}"
}
Could you provide some insights or examples on how I can implement this? Specifically, I’m looking for the best way to parse and pass the JSON data from my API to the PHP function linked to my custom hook.
Any help or direction on this would be greatly appreciated.
Thank you!