Unexpected changes in api response object names (expected = "contractualRules", received = "s:contractualRules")

Arthur Mougin 1 Reputation point
2022-09-10T15:38:18.413+00:00

Hi all,
When implementing Bing Web Search on a Nuxt3 project, I noticed that fetching the API returned valid objects with a weird twist.

Types are now "s:ImageObject" and some randomly selected object properties also include the s: as a prefix (like "s:thumbnailUrl").

It's an issue as I am working with Typescript, and such names are a pain to use (a.s:b -> a["s.b"]).

I fixed it by stringlifying, removing the unwanted prefix, and reparsing the response object.

const uncleanString = JSON.stringify(uncleanData);  
const cleanString = uncleanString.replaceAll("\"s:","\"")  
const cleanData = JSON.parse(cleanString)  

Do you know where that could come from?

Bing Web Search
Bing Web Search
A Bing service that gives you enhanced search details from billions of web documents.
127 questions
{count} votes