RevathySanthanam Posted November 14, 2014 Share Posted November 14, 2014 I am using multiple levels of JSON data coming into php from a C# application, as in: return new RootObject(){ID_Project = 4,Name_Project = "Test",Receiver_ID = 4,Receiver_Name = "ABCDE",UserID = 20,UserRole = new User_Role(){ID_User = 20,Role_User = "level 3",User_Role_Description = "U",UserGroup = new List<user_group>(){new User_Group() { ID_UserGroup = 30, Name_UserGroup = "usergroup8", UserID = 20 },new User_Group() { ID_UserGroup = 31, Name_UserGroup = "usergroup9", UserID = 21 },new User_Group() { ID_UserGroup = 32, Name_UserGroup = "usergroup10", UserID = 22 }}}}; i am having troubles accessing the second level: UserRole and 3rd level: User_Group in my php script.im currently trying like this: foreach ($phpArray as $key => $value) {echo "<h2>$key</h2>";foreach ($value as $k => $v) { echo "$k | $v"; foreach ($v as $key1) { echo "$key1";}}} does anyone have an idea? :confused: Thanks,Revathy Quote Link to comment https://forums.phpfreaks.com/topic/292458-accessing-json-decode-output-to-update-mysql-tables/ Share on other sites More sharing options...
Ch0cu3r Posted November 14, 2014 Share Posted November 14, 2014 What is the output of printf('<pre>%s</pre>', print_r(($phpArray, 1)); Quote Link to comment https://forums.phpfreaks.com/topic/292458-accessing-json-decode-output-to-update-mysql-tables/#findComment-1496593 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.