I am retrieving data from an API. The struct output is :
{
StreamSpecification: {
StreamEnabled: true,
StreamViewType: "NEW_AND_OLD_IMAGES"
},
TableStatus: "ACTIVE"
}
But if the API output does not have StreamSpecification in it, I am receiving the following error when trying to print the struct.
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=xxxxxxxx]
How to check if the struct StreamSpecification exists in the value? Or how to fix the issue in any other way?