diff --git a/src/servers/sapphire_api/SapphireAPI.cpp b/src/servers/sapphire_api/SapphireAPI.cpp index 33602b13..1f981514 100644 --- a/src/servers/sapphire_api/SapphireAPI.cpp +++ b/src/servers/sapphire_api/SapphireAPI.cpp @@ -133,13 +133,16 @@ Core::Network::SapphireAPI::createCharacter( const int& accountId, const std::st for( auto& v : json["content"] ) { - for( auto& vs : v ) + if( v.is_array() ) { - tmpVector.push_back( vs.get< int >() ); + for( auto& vs : v ) + { + tmpVector.push_back( std::stoi( std::string( vs ) ) ); + } } - if( !v.empty() ) - tmpVector2.push_back( v.get< int >() ); + if( !v.empty() && !v.is_array() ) + tmpVector2.push_back( std::stoi( std::string( v ) ) ); } // leaving this in for now for reference diff --git a/src/servers/sapphire_api/main.cpp b/src/servers/sapphire_api/main.cpp index 5d627b64..90edbd05 100644 --- a/src/servers/sapphire_api/main.cpp +++ b/src/servers/sapphire_api/main.cpp @@ -488,9 +488,7 @@ void checkSession( shared_ptr< HttpServer::Response > response, shared_ptr< Http else { std::string json_string = nlohmann::json( { - { "result", result }, - { "result2", "penis" }, - { "result3", "wtf" } + { "result", result } } ).dump() ; *response << buildHttpResponse( 200, json_string, JSON ); diff --git a/src/servers/sapphire_lobby/RestConnector.cpp b/src/servers/sapphire_lobby/RestConnector.cpp index d17fe938..96ac9c6f 100644 --- a/src/servers/sapphire_lobby/RestConnector.cpp +++ b/src/servers/sapphire_lobby/RestConnector.cpp @@ -143,7 +143,7 @@ uint32_t Core::Network::RestConnector::getNextCharId() if( content.find( "invalid" ) == std::string::npos ) { - return json["result"].get< uint32_t >(); + return std::stoi( std::string( json["result"] ) ); } else { @@ -182,7 +182,7 @@ uint64_t Core::Network::RestConnector::getNextContentId() if( content.find( "invalid" ) == std::string::npos ) { - return json["result"].get< uint64_t >(); + return std::stoll( std::string( json["result"] ) ); } else { @@ -313,7 +313,7 @@ int Core::Network::RestConnector::createCharacter( char* sId, std::string name, } if( content.find( "invalid" ) == std::string::npos ) - return json["result"].get< int >(); + return std::stoi( json["result"].get< std::string >() ); return -1; } else