Published 2 months ago by bart
I'm using the Affilinet PHP SDK that returns product data for a given shop. The data I get in return is an object with private properties and lots of getters.
What I want to store this raw object in my database for further manipulation later on. But using
json_encode() does not work here, due to the private scope of the properties. I can't add the implementation of \JsonSerializable because it's a third party class.
Do you have any idea how to store the plain object JSON? Thanks a lot!
thanks for the answer. Well, creating an array and setting all keys and values manually using the corresponding getter is possible. But I hope that there is a more elegant way to solve this.
I already played around with ReflectionClass but is it possible to get the private values from the original class using this way? That would do the trick!