Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/124.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ boost:read_json:reading多行_C++_Json_Boost - Fatal编程技术网

C++ boost:read_json:reading多行

C++ boost:read_json:reading多行,c++,json,boost,C++,Json,Boost,读取以下JSON数据时,我收到无效的代码序列异常 在read_json中 { "_ID":"18", "_Record":"1", "_BreakPageMessage":"abcd: 137 Product: ID: 1234 Description: 23456 abcdfm CustomerId: 23456 Component Id: 3456 Description: 12345 Admn RC - up c

读取以下JSON数据时,我收到无效的代码序列异常 在read_json中

{
   "_ID":"18",
   "_Record":"1",
   "_BreakPageMessage":"abcd: 137
     Product: ID: 1234
     Description: 23456 abcdfm
     CustomerId: 23456
     Component Id: 3456
     Description: 12345 Admn RC - up
     count: 40
     Sides 2
     Tarnish:
     size: 125 x 205
    Memo:"
}
_BreakPageMessage属性有多行。如果我们把它作为单行,一切都很好。 此_BreakPageMessage没有任何umlaut字符

boost::property_tree::read_json( file, pt );

可以告诉大家,无论如何都要使用Joost读取JSON,它有多行属性数据。我们使用C++和Booost。p> 换行符是JSON字符串,您的数据不是JSON

你可以逃离他们

{
   "_ID":"18",
   "_Record":"1",
   "_BreakPageMessage":"abcd: 137\r\n     Product: ID: 1234\r\n     Description: 23456 abcdfm\r\n     CustomerId: 23456\r\n     Component Id: 3456\r\n     Description: 12345 Admn RC - up\r\n     count: 40\r\n     Sides 2\r\n     Tarnish:\r\n     size: 125 x 205\r\n    Memo:"
}
或者使用子对象

{
   "_ID":"18",
   "_Record":"1",
   "_BreakPageMessage":{
      "abcd": 137,
      "Product": { "ID": 1234 },
      "Description": "23456 abcdfm",
      "CustomerId": "23456",
      "Component Id": "3456",
      "Description": "12345 Admn RC - up",
      "count": "40",
      "Sides": "2",
      "Tarnish": { size: "125 x 205" },
      "Memo":""
   }
}
换行符是JSON字符串,您的数据不是JSON

你可以逃离他们

{
   "_ID":"18",
   "_Record":"1",
   "_BreakPageMessage":"abcd: 137\r\n     Product: ID: 1234\r\n     Description: 23456 abcdfm\r\n     CustomerId: 23456\r\n     Component Id: 3456\r\n     Description: 12345 Admn RC - up\r\n     count: 40\r\n     Sides 2\r\n     Tarnish:\r\n     size: 125 x 205\r\n    Memo:"
}
或者使用子对象

{
   "_ID":"18",
   "_Record":"1",
   "_BreakPageMessage":{
      "abcd": 137,
      "Product": { "ID": 1234 },
      "Description": "23456 abcdfm",
      "CustomerId": "23456",
      "Component Id": "3456",
      "Description": "12345 Admn RC - up",
      "count": "40",
      "Sides": "2",
      "Tarnish": { size: "125 x 205" },
      "Memo":""
   }
}

此外,Boost PropertyTree不是JSON库。此外,Boost PropertyTree不是JSON库。