| 953 | } |
| 954 | |
| 955 | void JsonSerializer::LoadFromBytes(ISerializable* obj, const Span<byte>& data, int32 engineBuild) |
| 956 | { |
| 957 | if (!obj || data.Length() == 0) |
| 958 | return; |
| 959 | |
| 960 | ISerializable::SerializeDocument document; |
| 961 | { |
| 962 | PROFILE_CPU_NAMED("Json.Parse"); |
| 963 | document.Parse((const char*)data.Get(), data.Length()); |
| 964 | } |
| 965 | if (document.HasParseError()) |
| 966 | { |
| 967 | Log::JsonParseException(document.GetParseError(), document.GetErrorOffset()); |
| 968 | return; |
| 969 | } |
| 970 | |
| 971 | auto modifier = Cache::ISerializeModifier.Get(); |
| 972 | modifier->EngineBuild = engineBuild; |
| 973 | obj->Deserialize(document, modifier.Value); |
| 974 | } |
no test coverage detected