I have read a few anwsers on SO but none seem to come across what I need.
I have a function:
const geoDataRTB = () => {
return data.map((result) => result.request.buyerContext.request.geoData);
};
Which returns a json object.
"geoData": {
"type": "GPS",
"areaCode": "586",
"city": "MACOMB",
"country": "USA",
"metro": "505",
"latitude": "42.311859",
"longitude": "-85.579595",
"state": "MI",
"postalCode": "48042",
"bandwidth": "MOBILE",
"sic": "517312",
"domain": "MYVZW.COM",
"cityCode": 0
},
For example...currently I am returning geoData.city but id rather return the whole geoDta object instead. The end result is displayed via this
<section id='returnedData' className='mt-5 pb-5'>
<h2 className={h2Styles}>result</h2>
<div className='bg-gray-700 text-white rounded-md p-5 mt-5 '>
{data.map((result, i) => (
<div className='py-1'>
<span className='text-xs text-gray-400 font-mono'>Capture {i} : </span>
<span className='font-mono'>{result}</span>
<br />
</div>
))}
</div>
</section>
But when trying to return the geoData i get the object child error. Any suggestions on how to display the object? I have tried
const geoDataRTB = () => {
return data.map((result) => result.request.buyerContext.request.geoData.toString());
};
But this just returns [Object, Object]
resultasfont-mono's content, you may change your code to:<span className='font-mono'>{JSON.stringify(result)}</span>