cwmiller / broadworks-connector

Simple library for connecting to BroadWorks OCI-P API
MIT License
8 stars 5 forks source link

object response to array #57

Open TwinMist opened 3 years ago

TwinMist commented 3 years ago

Hi could there be a built in function to turn the object response into a array or multidimensional array with keys

thanks

TwinMist commented 3 years ago

HI what is the best way to achieve this?

cwmiller commented 3 years ago

It's not a very easy task. I thought maybe it could just be done by casting the response object as an array, but that doesn't work because all the fields are private.

The only way I can think of right now is to write something using reflection that calls all the getter methods on the response object to get all the field values. I may be able to implement some kind of asArray extension onto all the response objects to do this, but I'll have to mess with it some to see if it's doable.