@told.club/sdk-rn
Version:
Told React Native SDK
19 lines (17 loc) • 417 B
text/typescript
export function convertToJSONString(
dictionary: Record<string, string>
): string {
try {
if (Object.keys(dictionary).length === 0) {
return '[]';
}
const jsonArray = Object.entries(dictionary).map(([key, value]) => ({
key,
value,
}));
return JSON.stringify(jsonArray);
} catch (error) {
console.error('Error: JSONSerialization issue:', error);
return '[]';
}
}