In my React Native app I'm displaying modals that contain a printout of an object. I use the Alert.alert()
method, which you need to pass a string to. Since I have an object I want to print, I pass JSON.stringify(obj)
to the method. However, this prints the object like this:
{"prop1":"value1","prop2":"value2"}
Is there a way to print it like
{
prop1: value1,
prop2: value2
}
without looping through the keys of the object?