DEV Community

Discussion on: 👻 Do you have any horror stories to share? Spooky bugs, scary data leaks, horrifying code, etc. 🎃

Collapse
 
s_anastasov profile image
Stojan Anastasov

Working with a "REST" API today the error response was

{errorCode:1, error:"Error message"}

For the people who haven't had coffee yet, the quotes for errorCode and error are missing so it isn't a proper JSON. I think it actually took some effort to make it like this instead of proper JSON.

Collapse
 
mogery profile image
Gergő Móricz

Use eval()

Collapse
 
s_anastasov profile image
Stojan Anastasov • Edited

I am not sure what that does... I am writing the Android client (using Kotlin), the server code is written in PHP :)

Thread Thread
 
mogery profile image
Gergő Móricz

Oh,

that’s a valid object in JS, so if you would work in JS and put it in an eval function, it’d return the object.

PLEASE FOR THE LOVE OF GOD NEVER USE EVAL. IT’S VERY UNSAFE.