Trying to use json_decode on a simple json string inside a Kirby template doesn’t give me any errors, but it doesn’t parse correctly, either. Here’s the code:
Your code just works here. This is the output of var_dump(json_decode($data)->data);, from a template file on my dev setup:
object(stdClass)[207]
public 'title' => string 'Title' (length=5)
public 'question' => string 'Essential question' (length=18)
public 'text' => string '<p>Body text</p>' (length=16)
public 'images' =>
array (size=1)
0 =>
object(stdClass)[208]
public 'url' => string '/content/1-curriculum/1-biotechnology/biotechnology.jpg' (length=55)
public 'width' => int 960
public 'height' => int 640
public 'thumbs' =>
object(stdClass)[209]
...
Argh! Thanks for the replies. I just did a one-by-one check to see if a plugin was causing the problem, and of course it’s the kirby-html-minifier plugin I only recently enabled. Should have guessed that.
Thanks for your help and my apologies for not checking this first!