I'm trying to make a Unicode Converter from UTF-8 to UTF-16, but I want to only convert strings and objects and stuff like that in JSON, not the structure of JSON because that would make it unreadable to programs.
Entered UTF-8:
{
"hi":{
"this":["is","just","some","example"]
}
}
Expected UTF-16:
{
"\u0068\u0069":{
"\u0074\u0068\u0069\u0073":["\u0069\u0073","\u006a\u0075\u0073\u0074","\u0073\u006f\u006d\u0065","\u0065\u0078\u0061\u006d\u0070\u006c\u0065"]
}
}
Can anyone help? Also, I'm pretty new to Javascript, so don't be too harsh.