Jump to content

Recommended Posts

Posted

I have a trivial problem that is driving me insane.

I am saving JSON Data into a field:

$groupOverview->json_calendar_data = json_encode($eventsData);
$groupOverview->save();

image.thumb.png.ffa1b7ed5c54d02762bfb6bafe45feba.png

The JSON string is valid, as I have testet.

In the frontend I turn this string back into an array like this:

$eventsData = json_decode($groupOverview->json_calendar_data, true);
bd($eventsData);

The problem is: It always returns NULL.

Printing out the field value as string works fine though, this is not a field selector issue.

image.png.76716c2787e21a984ba9d5ef2a0f7ac2.png

Posted

hi,

looking at your dump, it sounds more like a htmlspecialchars encoding, you may either remove it from the field setting or use htmlspecialchars_decode on the output before json_decode 🙂

have a nice day

  • Like 2
Posted
14 minutes ago, virtualgadjo said:

hi,

looking at your dump, it sounds more like a htmlspecialchars encoding, you may either remove it from the field setting or use htmlspecialchars_decode on the output before json_decode 🙂

have a nice day

Thanks! You are right. After removing the HTML Entity Encoder Text Formatter form the field the decoding works.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...