MatureJsonValue.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. // Copyright 2024 Tracer Interactive, LLC. All Rights Reserved.
  2. #include "MatureJsonValue.h"
  3. #include "MatureJsonObject.h"
  4. #include "MatureJsonList.h"
  5. #include "MatureJsonLog.h"
  6. #include "json_cast.hpp"
  7. #include "Misc/FileHelper.h"
  8. #include "Policies/CondensedJsonPrintPolicy.h"
  9. #include "Policies/PrettyJsonPrintPolicy.h"
  10. FMatureJsonValue::ValueWrap::ValueWrap()
  11. : Document(MakeShared<mature::Document>())
  12. , ValueRef(*Document.Get())
  13. {
  14. }
  15. FMatureJsonValue::ValueWrap::ValueWrap(TSharedPtr<mature::Document> Doc)
  16. : Document(Doc)
  17. , ValueRef(*Document.Get())
  18. {
  19. }
  20. FMatureJsonValue::ValueWrap::ValueWrap(TSharedPtr<mature::Document> Doc, mature::Value& Ref)
  21. : Document(Doc)
  22. , ValueRef(Ref)
  23. {
  24. }
  25. bool FMatureJsonValue::ValueWrap::IsRoot() {
  26. void* Doc = Document.Get();
  27. void* ValPtr = &ValueRef;
  28. return Doc == ValPtr;
  29. }
  30. FMatureJsonValue::FMatureJsonValue(/*const TSharedPtr<mature::Document>& Doc*/)
  31. : ValueCache(MakeShared<ValueWrap>())
  32. {
  33. }
  34. FMatureJsonValue::FMatureJsonValue(const TSharedPtr<mature::Document>& Doc, mature::Value& v)
  35. : ValueCache(MakeShared<ValueWrap>(Doc, v))
  36. {
  37. }
  38. FMatureJsonValue::FMatureJsonValue(const FMatureJsonValue& rhs)
  39. : ValueCache(rhs.ValueCache)
  40. {
  41. }
  42. FMatureJsonValue& FMatureJsonValue::SetValue() {
  43. ValueRef().SetNull();
  44. return *this;
  45. }
  46. FMatureJsonValue& FMatureJsonValue::SetValue(const bool Value )
  47. {
  48. ValueRef().SetBool(Value);
  49. return *this;
  50. }
  51. FMatureJsonValue& FMatureJsonValue::SetValue(const float Value )
  52. {
  53. ValueRef().SetFloat(Value);
  54. return *this;
  55. }
  56. FMatureJsonValue& FMatureJsonValue::SetValue(const double Value )
  57. {
  58. ValueRef().SetDouble(Value);
  59. return *this;
  60. }
  61. FMatureJsonValue& FMatureJsonValue::SetValue(const int8 Value )
  62. {
  63. ValueRef().SetInt(Value);
  64. return *this;
  65. }
  66. FMatureJsonValue& FMatureJsonValue::SetValue(const uint8 Value )
  67. {
  68. ValueRef().SetUint(Value);
  69. return *this;
  70. }
  71. FMatureJsonValue& FMatureJsonValue::SetValue(const int16 Value )
  72. {
  73. ValueRef().SetInt(Value);
  74. return *this;
  75. }
  76. FMatureJsonValue& FMatureJsonValue::SetValue(const uint16 Value )
  77. {
  78. ValueRef().SetUint(Value);
  79. return *this;
  80. }
  81. FMatureJsonValue& FMatureJsonValue::SetValue(const int32 Value )
  82. {
  83. ValueRef().SetInt(Value);
  84. return *this;
  85. }
  86. FMatureJsonValue& FMatureJsonValue::SetValue(const uint32 Value )
  87. {
  88. ValueRef().SetUint(Value);
  89. return *this;
  90. }
  91. FMatureJsonValue& FMatureJsonValue::SetValue(const int64 Value )
  92. {
  93. ValueRef().SetInt64(Value);
  94. return *this;
  95. }
  96. FMatureJsonValue& FMatureJsonValue::SetValue(const uint64 Value )
  97. {
  98. ValueRef().SetUint64(Value);
  99. return *this;
  100. }
  101. FMatureJsonValue& FMatureJsonValue::SetValue(const TCHAR* Value)
  102. {
  103. FString in = Value;
  104. ValueRef().SetString(*in, in.Len(), GetAllocator());
  105. return *this;
  106. }
  107. FMatureJsonValue& FMatureJsonValue::SetValue( const FString& Value )
  108. {
  109. ValueRef().SetString(*Value, Value.Len(), GetAllocator());
  110. return *this;
  111. }
  112. FMatureJsonValue& FMatureJsonValue::SetValue( const FDateTime& Value)
  113. {
  114. FString serial = Value.ToIso8601();
  115. ValueRef().SetString(*serial, serial.Len(), GetAllocator());
  116. return *this;
  117. }
  118. FMatureJsonValue& FMatureJsonValue::SetValue( const FGuid& Value )
  119. {
  120. FString serial = Value.ToString(EGuidFormats::DigitsWithHyphens);
  121. ValueRef().SetString(*serial, serial.Len(), GetAllocator());
  122. return *this;
  123. }
  124. FMatureJsonValue& FMatureJsonValue::SetValue( const FColor& Value )
  125. {
  126. //
  127. FString serial = "#" + Value.ToHex();
  128. ValueRef().SetString(*serial, serial.Len(), GetAllocator());
  129. return *this;
  130. }
  131. FMatureJsonValue& FMatureJsonValue::SetValue(const FTransform& Value)
  132. {
  133. //
  134. ToObject().SetValue(Value);
  135. return *this;
  136. }
  137. FMatureJsonValue& FMatureJsonValue::SetValue(const FVector& Value)
  138. {
  139. //
  140. ToObject().SetValue(Value);
  141. return *this;
  142. }
  143. FMatureJsonValue& FMatureJsonValue::SetValue(const FRotator& Value)
  144. {
  145. //
  146. ToObject().SetValue(Value);
  147. return *this;
  148. }
  149. FMatureJsonValue& FMatureJsonValue::SetValue(const FLinearColor& Value)
  150. {
  151. ToObject().SetValue(Value);
  152. return *this;
  153. }
  154. FMatureJsonValue& FMatureJsonValue::SetValue(const FMatureJsonValue& Value) {
  155. ValueRef().CopyFrom(Value.ValueRef(), GetAllocator());
  156. return *this;
  157. }
  158. FMatureJsonValue& FMatureJsonValue::SetValue(const FMatureJsonObject& Value) {
  159. ToObject().SetValue(Value);
  160. return *this;
  161. }
  162. FMatureJsonValue& FMatureJsonValue::SetValue(const FMatureJsonList& Value) {
  163. if (ValueRef().GetType()!=mature::Type::kArrayType)ValueRef().SetArray();
  164. FMatureJsonList(Document(), ValueRef().GetArray()).AddValue(Value);
  165. return *this;
  166. }
  167. FMatureJsonValue& FMatureJsonValue::SetValue(mature::Value& Value) {
  168. ValueRef().CopyFrom(Value,GetAllocator());
  169. return *this;
  170. }
  171. EMatureJsonTypeNumber FMatureJsonValue::NumberType()const {
  172. if (mature::Type::kNumberType != ValueRef().GetType())return EMatureJsonTypeNumber::Unkown;
  173. if (ValueRef().IsDouble())return EMatureJsonTypeNumber::Double;
  174. else if (ValueRef().IsInt64())return EMatureJsonTypeNumber::Int64;
  175. else if (ValueRef().IsUint64())return EMatureJsonTypeNumber::Uint64;
  176. else if (ValueRef().IsInt())return EMatureJsonTypeNumber::Int32;
  177. else if (ValueRef().IsUint())return EMatureJsonTypeNumber::Uint32;
  178. return EMatureJsonTypeNumber::Unkown;
  179. }
  180. EMatureJsonType FMatureJsonValue::GetType() const
  181. {
  182. switch (ValueRef().GetType())
  183. {
  184. case mature::Type::kNullType: return EMatureJsonType::Null;
  185. case mature::Type::kFalseType : return EMatureJsonType::Bool;
  186. case mature::Type::kTrueType: return EMatureJsonType::Bool;
  187. case mature::Type::kNumberType: return EMatureJsonType::Number;
  188. case mature::Type::kStringType: return EMatureJsonType::String;
  189. case mature::Type::kObjectType: return EMatureJsonType::Object;
  190. case mature::Type::kArrayType: return EMatureJsonType::Array;
  191. }
  192. return EMatureJsonType::Null;
  193. }
  194. int FMatureJsonValue::Size() const {
  195. return ValueRef().Size();
  196. }
  197. bool FMatureJsonValue::IsEmpty() const {
  198. return ValueRef().Empty();
  199. }
  200. void FMatureJsonValue::Clear() {
  201. ValueRef().Clear();
  202. }
  203. bool FMatureJsonValue::ToBoolean() const
  204. {
  205. switch (ValueRef().GetType())
  206. {
  207. case mature::Type::kFalseType: return ValueRef().GetBool();
  208. case mature::Type::kTrueType: return ValueRef().GetBool();
  209. case mature::Type::kNumberType: return mature::GetNumber<bool>(ValueRef());
  210. case mature::Type::kStringType: return FString(ValueRef().GetString()).ToBool();
  211. }
  212. return false;
  213. }
  214. float FMatureJsonValue::ToFloat() const
  215. {
  216. return mature::GetNumber<float>(ValueRef());
  217. }
  218. double FMatureJsonValue::ToNumber() const
  219. {
  220. return mature::GetNumber<double>(ValueRef());
  221. }
  222. int32 FMatureJsonValue::ToInteger() const
  223. {
  224. return mature::GetNumber<int32>(ValueRef());
  225. }
  226. FString FMatureJsonValue::ToString() const
  227. {
  228. switch (ValueRef().GetType())
  229. {
  230. case mature::Type::kFalseType: return TEXT("false");
  231. case mature::Type::kTrueType: return TEXT("true");
  232. case mature::Type::kNumberType: return FString::SanitizeFloat(mature::GetNumber<float>(ValueRef()), 0);
  233. case mature::Type::kStringType: return FString(ValueRef().GetString());
  234. }
  235. return FString();
  236. }
  237. FDateTime FMatureJsonValue::ToDateTime() const
  238. {
  239. if (mature::Type::kStringType != ValueRef().GetType())
  240. return FDateTime();
  241. FDateTime DateTime;
  242. if (FDateTime::ParseIso8601(ValueRef().GetString(), DateTime))
  243. return DateTime;
  244. return FDateTime();
  245. }
  246. FGuid FMatureJsonValue::ToGuid() const
  247. {
  248. if (mature::Type::kStringType != ValueRef().GetType())
  249. return FGuid();
  250. FGuid Guid;
  251. if (FGuid::Parse(ValueRef().GetString(), Guid))
  252. return Guid;
  253. return FGuid();
  254. }
  255. FLinearColor FMatureJsonValue::ToLinearColor() const {
  256. FLinearColor value;
  257. if (ValueRef().GetType() != mature::Type::kObjectType)return value;
  258. ToObject().GetValue(value);
  259. return value;
  260. }
  261. FColor FMatureJsonValue::ToColor() const
  262. {
  263. if (mature::Type::kStringType != ValueRef().GetType())
  264. return FColor();
  265. if (IsColor(ValueRef().GetString()))
  266. return FColor::FromHex(ValueRef().GetString());
  267. return FColor();
  268. }
  269. FMatureJsonObject FMatureJsonValue::ToObject(bool check) const
  270. {
  271. if (ValueRef().GetType() != mature::Type::kObjectType)
  272. {
  273. if (!(check == false || ValueRef().GetType() == mature::Type::kNullType)) {
  274. return FMatureJsonObject();
  275. }
  276. ValueRef().SetObject();
  277. }
  278. return FMatureJsonObject(Document(), ValueRef().GetObject());
  279. }
  280. FMatureJsonList FMatureJsonValue::ToList(bool check) const
  281. {
  282. if (ValueRef().GetType() != mature::Type::kArrayType)
  283. {
  284. if (!(check == false || ValueRef().GetType() == mature::Type::kNullType)) {
  285. return FMatureJsonList();
  286. }
  287. ValueRef().SetArray();
  288. }
  289. return FMatureJsonList(Document(), ValueRef().GetArray());
  290. }
  291. int32 FMatureJsonValue::ToInt32() const
  292. {
  293. return mature::GetNumber<int32>(ValueRef());
  294. }
  295. uint32 FMatureJsonValue::ToUInt32() const
  296. {
  297. return mature::GetNumber<uint32>(ValueRef());
  298. }
  299. int64 FMatureJsonValue::ToInt64() const
  300. {
  301. return mature::GetNumber<int64>(ValueRef());
  302. }
  303. uint64 FMatureJsonValue::ToUInt64() const
  304. {
  305. return mature::GetNumber<uint64>(ValueRef());
  306. }
  307. bool FMatureJsonValue::GetValue(bool& value)const {
  308. if (mature::Type::kNumberType != ValueRef().GetType())return false;
  309. if (ValueRef().IsDouble())value = 0.05f <= ValueRef().GetDouble() || (ValueRef().GetDouble()) <= -0.05f;
  310. else if (ValueRef().IsInt64())value = bool (ValueRef().GetInt64());
  311. else if (ValueRef().IsUint64())value = bool(ValueRef().GetUint64());
  312. else if (ValueRef().IsInt())value = bool(ValueRef().GetInt());
  313. else if (ValueRef().IsUint())value = bool(ValueRef().GetUint());
  314. else return false;
  315. return false;
  316. //return GetNumberBool<bool>(ValueRef(), value);
  317. }
  318. bool FMatureJsonValue::GetValue(float& value)const {
  319. if (mature::Type::kNumberType != ValueRef().GetType())return false;
  320. if (ValueRef().IsDouble())value = (ValueRef().GetDouble());
  321. else if (ValueRef().IsInt64())value = (ValueRef().GetInt64());
  322. else if (ValueRef().IsUint64())value = (ValueRef().GetUint64());
  323. else if (ValueRef().IsInt())value = (ValueRef().GetInt());
  324. else if (ValueRef().IsUint())value = (ValueRef().GetUint());
  325. else return false;
  326. return false;
  327. }
  328. bool FMatureJsonValue::GetValue(int32& value)const {
  329. if (mature::Type::kNumberType != ValueRef().GetType())return false;
  330. if (ValueRef().IsDouble())value = (ValueRef().GetDouble());
  331. else if (ValueRef().IsInt64())value = (ValueRef().GetInt64());
  332. else if (ValueRef().IsUint64())value = (ValueRef().GetUint64());
  333. else if (ValueRef().IsInt())value = (ValueRef().GetInt());
  334. else if (ValueRef().IsUint())value = (ValueRef().GetUint());
  335. else return false;
  336. return false;
  337. }
  338. bool FMatureJsonValue::GetValue(int64& value)const {
  339. if (mature::Type::kNumberType != ValueRef().GetType())return false;
  340. if (ValueRef().IsDouble())value = (ValueRef().GetDouble());
  341. else if (ValueRef().IsInt64())value = (ValueRef().GetInt64());
  342. else if (ValueRef().IsUint64())value = (ValueRef().GetUint64());
  343. else if (ValueRef().IsInt())value = (ValueRef().GetInt());
  344. else if (ValueRef().IsUint())value = (ValueRef().GetUint());
  345. else return false;
  346. return false;
  347. }
  348. bool FMatureJsonValue::GetValue(uint32& value)const {
  349. if (mature::Type::kNumberType != ValueRef().GetType())return false;
  350. if (ValueRef().IsDouble())value = (ValueRef().GetDouble());
  351. else if (ValueRef().IsInt64())value = (ValueRef().GetInt64());
  352. else if (ValueRef().IsUint64())value = (ValueRef().GetUint64());
  353. else if (ValueRef().IsInt())value = (ValueRef().GetInt());
  354. else if (ValueRef().IsUint())value = (ValueRef().GetUint());
  355. else return false;
  356. return false;
  357. }
  358. bool FMatureJsonValue::GetValue(uint64& value)const {
  359. if (mature::Type::kNumberType != ValueRef().GetType())return false;
  360. if (ValueRef().IsDouble())value = (ValueRef().GetDouble());
  361. else if (ValueRef().IsInt64())value = (ValueRef().GetInt64());
  362. else if (ValueRef().IsUint64())value = (ValueRef().GetUint64());
  363. else if (ValueRef().IsInt())value = (ValueRef().GetInt());
  364. else if (ValueRef().IsUint())value = (ValueRef().GetUint());
  365. else return false;
  366. return false;
  367. }
  368. bool FMatureJsonValue::GetValue(double& value)const {
  369. if (mature::Type::kNumberType != ValueRef().GetType())return false;
  370. if (ValueRef().IsDouble())value = (ValueRef().GetDouble());
  371. else if (ValueRef().IsInt64())value = (ValueRef().GetInt64());
  372. else if (ValueRef().IsUint64())value = (ValueRef().GetUint64());
  373. else if (ValueRef().IsInt())value = (ValueRef().GetInt());
  374. else if (ValueRef().IsUint())value = (ValueRef().GetUint());
  375. else return false;
  376. return false;
  377. }
  378. bool FMatureJsonValue::GetValue(FString& value)const {
  379. return GetStringBool(ValueRef(), value);
  380. }
  381. bool FMatureJsonValue::GetValue(FDateTime& value)const {
  382. if (mature::Type::kStringType != ValueRef().GetType())
  383. return false;
  384. return FDateTime::ParseIso8601(ValueRef().GetString(), value);
  385. }
  386. bool FMatureJsonValue::GetValue(FGuid& value)const {
  387. if (mature::Type::kStringType != ValueRef().GetType())
  388. return false;
  389. if (FGuid::Parse(ValueRef().GetString(), value))
  390. return value.IsValid();
  391. return false;
  392. }
  393. bool FMatureJsonValue::GetValue(FColor& value)const {
  394. if (mature::Type::kStringType != ValueRef().GetType())
  395. return false;
  396. if (!IsColor(ValueRef().GetString()))
  397. return false;
  398. value = FColor::FromHex(ValueRef().GetString());
  399. return true;
  400. }
  401. bool FMatureJsonValue::GetValue(FLinearColor& value)const {
  402. if (ValueRef().GetType() != mature::Type::kObjectType)return false;;
  403. ToObject().GetValue(value);
  404. return true;
  405. }
  406. bool FMatureJsonValue::GetValue(FRotator& value)const {
  407. if (mature::Type::kObjectType != ValueRef().GetType())
  408. return false;
  409. ToObject().GetValue(value);
  410. return true;
  411. }
  412. bool FMatureJsonValue::GetValue(FVector& value)const {
  413. if (mature::Type::kObjectType != ValueRef().GetType())
  414. return false;
  415. ToObject().GetValue(value);
  416. return true;
  417. }
  418. bool FMatureJsonValue::GetValue(FTransform& value)const {
  419. if (mature::Type::kObjectType != ValueRef().GetType())
  420. return false;
  421. ToObject().GetValue(value);
  422. return true;
  423. }
  424. bool FMatureJsonValue::IsDateTime() const
  425. {
  426. if (mature::Type::kStringType != ValueRef().GetType())
  427. return false;
  428. FDateTime DateTime;
  429. return FDateTime::ParseIso8601(ValueRef().GetString(), DateTime );
  430. }
  431. bool FMatureJsonValue::IsGuid() const
  432. {
  433. if (mature::Type::kStringType != ValueRef().GetType())
  434. return false;
  435. FGuid Guid;
  436. if ( FGuid::Parse(ValueRef().GetString(), Guid ) )
  437. return Guid.IsValid();
  438. return false;
  439. }
  440. bool FMatureJsonValue::IsColor(FString hex_string) const
  441. {
  442. if (hex_string.IsEmpty() )
  443. return false;
  444. if (hex_string.StartsWith(TEXT("#"))) {
  445. hex_string.RemoveAt(0, 1);
  446. }
  447. int32 StartIndex = 0;
  448. if (hex_string.Len() == 8 )
  449. {
  450. for (int32 i = 0; i < 8; i++)
  451. if (!FChar::IsHexDigit(hex_string[StartIndex++]))
  452. return false;
  453. return true;
  454. }
  455. if (hex_string.Len() == 6 )
  456. {
  457. for (int32 i = 0; i < 6; i++)
  458. if (!FChar::IsHexDigit(hex_string[StartIndex++]))
  459. return false;
  460. return true;
  461. }
  462. if (hex_string.Len() == 3 )
  463. {
  464. for ( int32 i = 0; i < 3; i++ )
  465. if ( !FChar::IsHexDigit(hex_string[ StartIndex++ ] ) )
  466. return false;
  467. return true;
  468. }
  469. return false;
  470. }
  471. FMatureJsonValue& FMatureJsonValue::operator=(const FMatureJsonValue& rhs) {
  472. ValueCache = rhs.ValueCache;
  473. return *this;
  474. }
  475. bool FMatureJsonValue::Parse(const FString& Text) {
  476. ValueCache = MakeShared<ValueWrap>();
  477. Document()->Parse(*Text);
  478. if (!Document()->HasParseError())return true;
  479. int offset = Document()->GetErrorOffset();
  480. rapidjson::ParseErrorCode errorCode = Document()->GetParseError();
  481. FString ErrorPos;
  482. if (offset < Text.Len() && errorCode != rapidjson::ParseErrorCode::kParseErrorDocumentEmpty) {
  483. ErrorPos = FString((*Text) + offset, 20);
  484. }
  485. FString Desc = UTF8_TO_TCHAR( rapidjson::GetParseError_En(errorCode));
  486. UE_LOG(MatureJsonLog,Log,TEXT("Parse Error: ErrorCode[%d] Desc[%s] pos[%d] Content[%s]")
  487. , errorCode , *Desc, offset, *ErrorPos
  488. );
  489. return false;
  490. }
  491. bool FMatureJsonValue::ParseFile(const FString& FileName) {
  492. FString FileContents;
  493. if (!FFileHelper::LoadFileToString(FileContents, *FileName)) {
  494. return false;
  495. }
  496. return Parse(FileContents);
  497. }
  498. FString FMatureJsonValue::SaveString() const{
  499. mature::StringBuffer buffer;
  500. mature::Writer writer(buffer);
  501. TSharedPtr<ValueWrap> DocRoot;
  502. if (ValueCache->IsRoot()) {
  503. DocRoot = ValueCache;
  504. }
  505. else {
  506. DocRoot = MakeShared<ValueWrap>();
  507. DocRoot->ValueRef.CopyFrom(ValueCache->ValueRef, DocRoot->Document->GetAllocator());
  508. }
  509. if (!DocRoot->Document->Accept(writer))
  510. return FString();
  511. return buffer.GetString();
  512. }
  513. bool FMatureJsonValue::SaveFile(FString FileName) const {
  514. return FFileHelper::SaveStringToFile(SaveString(), *FileName);
  515. }
  516. TSharedPtr<mature::Document> FMatureJsonValue::Document() {
  517. return ValueCache->Document;
  518. }
  519. TSharedPtr<mature::Document> FMatureJsonValue::Document() const {
  520. return ValueCache->Document;
  521. }
  522. inline mature::Value& FMatureJsonValue::ValueRef() {
  523. return ValueCache->ValueRef;
  524. }
  525. inline mature::Value& FMatureJsonValue::ValueRef() const {
  526. return ValueCache->ValueRef;
  527. }
  528. inline mature::Allocator& FMatureJsonValue::GetAllocator() {
  529. return ValueCache->Document->GetAllocator();
  530. }
  531. inline mature::Allocator& FMatureJsonValue::GetAllocator()const {
  532. return ValueCache->Document->GetAllocator();
  533. }