C++ boost:read_json:reading多行
读取以下JSON数据时,我收到无效的代码序列异常 在read_json中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
{
"_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库。