JSON parse

Top new questions this week:

Why are emoji characters like 👩👩👧👦 treated so strangely in Swift strings?

The character 👩👩👧👦 (family with two women, one girl, and one boy) is encoded as such: U+1F469 WOMAN, ‍U+200D ZWJ, U+1F469 WOMAN, U+200D ZWJ, U+1F467 GIRL, U+200D ZWJ, U+1F466 BOY So it’s very …

swift string unicode emoji
asked by Ben Leggiero 360 votes
answered by xoudini 268 votes

Why does JSON.parse([‘1234’]) return 1234?

I am having problems understanding the behavior of JSON.parse. JSON.parse should work for only strings. But it seems to work for an array which contains only one string (even single quoted), if the …

javascript json
asked by Akshendra Pratap 43 votes
answered by BoltClock 101 votes

Does the C++ standard guarantee that uniform initialization is exception-safe?

#include <iostream> using namespace std; struct A { A() { cout << “A” << endl; } ~A() { cout << “~A” << endl; } }; A Ok() { return {}; } A NotOk() { throw …

c++ exception gcc c++1z uniform-initialization
asked by xmllmx 35 votes
answered by AndyG 21 votes
Stack Overflow Jobs puts developers first.
No recruiter spam or fake listings
Browse Jobs

Are all integer values perfectly represented as doubles?

My question is whether all integer values are guaranteed to have a perfect double representation. Consider the following code sample that prints “Same”: // Example program #include <iostream> …

c++ double standards precision ieee-754
asked by Thomas 34 votes
answered by Beginner 44 votes

why is #include<string> preventing a stackoverflow error here?

This is my sample code: #include<iostream> #include<string> using namespace std; class MyClass { string figName; public: MyClass(const string& s) { figName = s; …

c++ string stack-overflow
asked by airborne 25 votes
answered by Pavel 43 votes

Get enum values via reflection from nested enum in generic class

I need to print out enum values and their corresponding underyling values from certain types i accquire through reflection. This works fine most of the time. However if the enum is declared within a …

c# generics reflection enums
asked by CSharpie 23 votes
answered by Jon Skeet 28 votes

std::bind on a generic lambda – auto type deduction

Consider the following code: #include <iostream> #include <functional> int main() { auto run = [](auto&& f, auto&& arg) { …

c++ c++14
asked by Kinan Al Sarmini 21 votes
answered by Columbo 6 votes

Greatest hits from previous weeks:

Validate email address in JavaScript?

How can an email address be validated in JavaScript?

javascript regex validation email email-validation
asked by pix0r 2398 votes
answered by sectrean 2857 votes

What is the maximum value for an int32?

I can never remember the number. I need a memory rule.

asked by Flinkman 1041 votes
answered by Ben Hoffstein 3874 votes

Can you answer these?

Shallow-copying into a protocol buffer’s bytes field

Suppose I have a proto with a bytes field: message MyProto { optional bytes data = 1; } An API that I do not control gives me a pointer to source data and its size. I want to make a MyProto out …

c++ protocol-buffers
asked by Chris 5 votes

Dynamically creating Akka Stream Flows at Runtime

I’m currently trying to dynamically create Akka Stream graph definitions at runtime. The idea being that users will be able to define flows interactively and attach them to existing/running …

scala akka shapeless akka-stream type-erasure
asked by Stephen Woods 5 votes

How does Shopify make their liquid templates safe (avoid XSS)?

Shopify automatically escapes values if they are used in not safe way, but I have not found this feature in liquid gem. Example: template: <div data=”{{ user_name }}”>{{ user_name …

wordpress , MySQL , Oracol