Click here to Skip to main content
15,886,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is sample of code.

{
"Abc":{
"scs":"1",
"Cat": "games",
"CatS" : "1",

"playlists": [
{
"id": "1",
"x": "something"

},
{
"id": "1",
"x": "something"

}
]

}
}

till cats I am getting the data but after playlists I don't know how to process for a subchild(playlist).

Need in Help!!!!!!!!!!
Posted
Comments
Richard MacCutchan 24-Dec-14 10:35am    
What is this data and what are you using to process it?
[no name] 24-Dec-14 13:41pm    
This isn't code. This is a fragment of JSON data. Where is your code?
I.P.Katti 29-Dec-14 1:35am    
//hello here is code
try
{
BOOST_FOREACH(boost::property_tree::ptree::value_type &v, pt1.get_child("Abc"))
{

if(v.first == "scs")
{
int szData;// = v.second.data();
szData = v.second.get_value<int>();
}

if(v.first == "Cat")
{
std::string szData = v.second.data();
CString sztemp;
sztemp.Format(_T("%S"), szData.c_str());
}

if(v.first == "CatS")
{
std::string szData = v.second.data();
CString sztemp;
sztemp.Format(_T("%S"), szData.c_str());
}

BOOST_FOREACH(boost::property_tree::ptree::value_type &pt1, v.second.get_child("playlists"))
{

boost::property_tree::ptree pt2 = v.second;
if(v.first == "id")
{
std::string szData = v.second.data();
CString sztemp;
sztemp.Format(_T("%S"), szData.c_str());
}
}

}


{
BOOST_FOREACH(boost::property_tree::ptree::value_type &playlist, v.second.get_child("playlists"))
{
if(v.first == "id")
{
std::string szData = v.second.data();
CString sztemp;
sztemp.Format(_T("%S"), szData.c_str());
}
}
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900