I have some JSON strings structured as follows:
{
name: 'test',
url: 'http://test.org',
contact: {
email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0263636342766771762c616d6f">[email protected]</a>',
address: 'ab road'
}
}
My goal is to define a type for this data, so I attempted the following:
type Site = {
name: String,
url: String,
contact: {
email: String,
address: String
}
};
However, I encountered an error message stating:
Unexpected token n in JSON at position 15
As I am not well-versed with TypeScript, I wonder if it is feasible to define types in such a nested manner that closely mirrors the structure of the actual JSON. Is this achievable? If so, what is the correct approach to defining it?