get specific data from json array php [duplicate]












0
















This question already has an answer here:




  • How do I extract data from JSON with PHP?

    4 answers




I am trying to get a string out of an array, that I receive from an external API, but so far i haven't had any luck.



This is the array:



stdClass Object 
(
[type] => FeatureCollection
[totalFeatures] => 1
[features] => Array
(
[0] => stdClass Object
(
[type] => Feature
[id] => perceel.4304705
[geometry] => stdClass Object
(
[type] => Polygon
[coordinates] => Array
(
[0] => Array
(
[0] => Array
(
[0] => 135608.866
[1] => 444767.317
)
[1] => Array
(
[0] => 135638.627
[1] => 444759.41
)
[2] => Array
(
[0] => 135640.736
[1] => 444758.912
)
[3] => Array
(
[0] => 135642.048
[1] => 444758.752
)
[4] => Array
(
[0] => 135643.376
[1] => 444758.88
)
[5] => Array
(
[0] => 135644.544
[1] => 444759.104
)
[6] => Array
(
[0] => 135645.568
[1] => 444759.552
)
[7] => Array
(
[0] => 135646.512
[1] => 444760.064
)
[8] => Array
(
[0] => 135647.472
[1] => 444760.896
)
[9] => Array
(
[0] => 135648.176
[1] => 444761.664
)
[10] => Array
(
[0] => 135648.72
[1] => 444762.464
)
[11] => Array
(
[0] => 135649.136
[1] => 444763.552
)
[12] => Array
(
[0] => 135650.208
[1] => 444766.528
)
[13] => Array
(
[0] => 135653.968
[1] => 444777.568
)
[14] => Array
(
[0] => 135654.464
[1] => 444779.36
)
[15] => Array
(
[0] => 135660.672
[1] => 444802.784
)
[16] => Array
(
[0] => 135667.088
[1] => 444826.912
)
[17] => Array
(
[0] => 135669.351
[1] => 444835.724
)
[18] => Array
(
[0] => 135673.947
[1] => 444852.99
)
[19] => Array
(
[0] => 135680.226
[1] => 444851.14
)
[20] => Array
(
[0] => 135687.926
[1] => 444871.704
)
[21] => Array
(
[0] => 135688.078
[1] => 444872.023
)
[22] => Array
(
[0] => 135688.056
[1] => 444872.376
)
[23] => Array
(
[0] => 135687.892
[1] => 444872.648
)
[24] => Array
(
[0] => 135687.665
[1] => 444872.796
)
[25] => Array
(
[0] => 135681.376
[1] => 444874.368
)
[26] => Array
(
[0] => 135638.985
[1] => 444885.681
)
[27] => Array
(
[0] => 135624.48
[1] => 444831.424
)
[28] => Array
(
[0] => 135619.072
[1] => 444811.2
)
[29] => Array
(
[0] => 135613.504
[1] => 444790.432
)
[30] => Array
(
[0] => 135607.894
[1] => 444768.679
)
[31] => Array
(
[0] => 135608.866
[1] => 444767.317
)
)
)
)
[geometry_name] => begrenzingperceel
[properties] => stdClass Object
(
[lokaalID] => 340113504
[logischtijdstipOntstaan] => 2009-03-27T23:59:59.000
[logischtijdstipVervallen] =>
[kadastraleGemeenteCode] => VAN00
[sectie] => B
[kadastralegrootte] => 5340
[perceelnummer] => 3857
[perceelnummer_rotatie] => 0
[perceelnummer_deltax] => 0
[perceelnummer_deltay] => 0
[plaatscoordinaten] => stdClass Object
(
[type] => Point
[coordinates] => Array
(
[0] => 135644.749
[1] => 444828.56
)
)
)
)
)
[crs] => stdClass Object
(
[type] => name
[properties] => stdClass Object
(
[name] => urn:ogc:def:crs:EPSG::28992
)
)
)


I am trying to get "[kadastralegrootte] => 5340", and than only the "5340" part.



I have tried something like this:



$json = json_decode($result, true);    
$grootte = $json->features->properties->kadastralegrootte;
echo "$grootte";


Where $result is a json file.
So far no luck. I would really appreciate it if someone took a look.










share|improve this question













marked as duplicate by Paul php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 15 '18 at 20:14


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    Can you give us the json string? so we can decode it and try to help you, but give us the json encoded string please

    – Luis Cabrera Benito
    Nov 15 '18 at 18:17
















0
















This question already has an answer here:




  • How do I extract data from JSON with PHP?

    4 answers




I am trying to get a string out of an array, that I receive from an external API, but so far i haven't had any luck.



This is the array:



stdClass Object 
(
[type] => FeatureCollection
[totalFeatures] => 1
[features] => Array
(
[0] => stdClass Object
(
[type] => Feature
[id] => perceel.4304705
[geometry] => stdClass Object
(
[type] => Polygon
[coordinates] => Array
(
[0] => Array
(
[0] => Array
(
[0] => 135608.866
[1] => 444767.317
)
[1] => Array
(
[0] => 135638.627
[1] => 444759.41
)
[2] => Array
(
[0] => 135640.736
[1] => 444758.912
)
[3] => Array
(
[0] => 135642.048
[1] => 444758.752
)
[4] => Array
(
[0] => 135643.376
[1] => 444758.88
)
[5] => Array
(
[0] => 135644.544
[1] => 444759.104
)
[6] => Array
(
[0] => 135645.568
[1] => 444759.552
)
[7] => Array
(
[0] => 135646.512
[1] => 444760.064
)
[8] => Array
(
[0] => 135647.472
[1] => 444760.896
)
[9] => Array
(
[0] => 135648.176
[1] => 444761.664
)
[10] => Array
(
[0] => 135648.72
[1] => 444762.464
)
[11] => Array
(
[0] => 135649.136
[1] => 444763.552
)
[12] => Array
(
[0] => 135650.208
[1] => 444766.528
)
[13] => Array
(
[0] => 135653.968
[1] => 444777.568
)
[14] => Array
(
[0] => 135654.464
[1] => 444779.36
)
[15] => Array
(
[0] => 135660.672
[1] => 444802.784
)
[16] => Array
(
[0] => 135667.088
[1] => 444826.912
)
[17] => Array
(
[0] => 135669.351
[1] => 444835.724
)
[18] => Array
(
[0] => 135673.947
[1] => 444852.99
)
[19] => Array
(
[0] => 135680.226
[1] => 444851.14
)
[20] => Array
(
[0] => 135687.926
[1] => 444871.704
)
[21] => Array
(
[0] => 135688.078
[1] => 444872.023
)
[22] => Array
(
[0] => 135688.056
[1] => 444872.376
)
[23] => Array
(
[0] => 135687.892
[1] => 444872.648
)
[24] => Array
(
[0] => 135687.665
[1] => 444872.796
)
[25] => Array
(
[0] => 135681.376
[1] => 444874.368
)
[26] => Array
(
[0] => 135638.985
[1] => 444885.681
)
[27] => Array
(
[0] => 135624.48
[1] => 444831.424
)
[28] => Array
(
[0] => 135619.072
[1] => 444811.2
)
[29] => Array
(
[0] => 135613.504
[1] => 444790.432
)
[30] => Array
(
[0] => 135607.894
[1] => 444768.679
)
[31] => Array
(
[0] => 135608.866
[1] => 444767.317
)
)
)
)
[geometry_name] => begrenzingperceel
[properties] => stdClass Object
(
[lokaalID] => 340113504
[logischtijdstipOntstaan] => 2009-03-27T23:59:59.000
[logischtijdstipVervallen] =>
[kadastraleGemeenteCode] => VAN00
[sectie] => B
[kadastralegrootte] => 5340
[perceelnummer] => 3857
[perceelnummer_rotatie] => 0
[perceelnummer_deltax] => 0
[perceelnummer_deltay] => 0
[plaatscoordinaten] => stdClass Object
(
[type] => Point
[coordinates] => Array
(
[0] => 135644.749
[1] => 444828.56
)
)
)
)
)
[crs] => stdClass Object
(
[type] => name
[properties] => stdClass Object
(
[name] => urn:ogc:def:crs:EPSG::28992
)
)
)


I am trying to get "[kadastralegrootte] => 5340", and than only the "5340" part.



I have tried something like this:



$json = json_decode($result, true);    
$grootte = $json->features->properties->kadastralegrootte;
echo "$grootte";


Where $result is a json file.
So far no luck. I would really appreciate it if someone took a look.










share|improve this question













marked as duplicate by Paul php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 15 '18 at 20:14


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    Can you give us the json string? so we can decode it and try to help you, but give us the json encoded string please

    – Luis Cabrera Benito
    Nov 15 '18 at 18:17














0












0








0









This question already has an answer here:




  • How do I extract data from JSON with PHP?

    4 answers




I am trying to get a string out of an array, that I receive from an external API, but so far i haven't had any luck.



This is the array:



stdClass Object 
(
[type] => FeatureCollection
[totalFeatures] => 1
[features] => Array
(
[0] => stdClass Object
(
[type] => Feature
[id] => perceel.4304705
[geometry] => stdClass Object
(
[type] => Polygon
[coordinates] => Array
(
[0] => Array
(
[0] => Array
(
[0] => 135608.866
[1] => 444767.317
)
[1] => Array
(
[0] => 135638.627
[1] => 444759.41
)
[2] => Array
(
[0] => 135640.736
[1] => 444758.912
)
[3] => Array
(
[0] => 135642.048
[1] => 444758.752
)
[4] => Array
(
[0] => 135643.376
[1] => 444758.88
)
[5] => Array
(
[0] => 135644.544
[1] => 444759.104
)
[6] => Array
(
[0] => 135645.568
[1] => 444759.552
)
[7] => Array
(
[0] => 135646.512
[1] => 444760.064
)
[8] => Array
(
[0] => 135647.472
[1] => 444760.896
)
[9] => Array
(
[0] => 135648.176
[1] => 444761.664
)
[10] => Array
(
[0] => 135648.72
[1] => 444762.464
)
[11] => Array
(
[0] => 135649.136
[1] => 444763.552
)
[12] => Array
(
[0] => 135650.208
[1] => 444766.528
)
[13] => Array
(
[0] => 135653.968
[1] => 444777.568
)
[14] => Array
(
[0] => 135654.464
[1] => 444779.36
)
[15] => Array
(
[0] => 135660.672
[1] => 444802.784
)
[16] => Array
(
[0] => 135667.088
[1] => 444826.912
)
[17] => Array
(
[0] => 135669.351
[1] => 444835.724
)
[18] => Array
(
[0] => 135673.947
[1] => 444852.99
)
[19] => Array
(
[0] => 135680.226
[1] => 444851.14
)
[20] => Array
(
[0] => 135687.926
[1] => 444871.704
)
[21] => Array
(
[0] => 135688.078
[1] => 444872.023
)
[22] => Array
(
[0] => 135688.056
[1] => 444872.376
)
[23] => Array
(
[0] => 135687.892
[1] => 444872.648
)
[24] => Array
(
[0] => 135687.665
[1] => 444872.796
)
[25] => Array
(
[0] => 135681.376
[1] => 444874.368
)
[26] => Array
(
[0] => 135638.985
[1] => 444885.681
)
[27] => Array
(
[0] => 135624.48
[1] => 444831.424
)
[28] => Array
(
[0] => 135619.072
[1] => 444811.2
)
[29] => Array
(
[0] => 135613.504
[1] => 444790.432
)
[30] => Array
(
[0] => 135607.894
[1] => 444768.679
)
[31] => Array
(
[0] => 135608.866
[1] => 444767.317
)
)
)
)
[geometry_name] => begrenzingperceel
[properties] => stdClass Object
(
[lokaalID] => 340113504
[logischtijdstipOntstaan] => 2009-03-27T23:59:59.000
[logischtijdstipVervallen] =>
[kadastraleGemeenteCode] => VAN00
[sectie] => B
[kadastralegrootte] => 5340
[perceelnummer] => 3857
[perceelnummer_rotatie] => 0
[perceelnummer_deltax] => 0
[perceelnummer_deltay] => 0
[plaatscoordinaten] => stdClass Object
(
[type] => Point
[coordinates] => Array
(
[0] => 135644.749
[1] => 444828.56
)
)
)
)
)
[crs] => stdClass Object
(
[type] => name
[properties] => stdClass Object
(
[name] => urn:ogc:def:crs:EPSG::28992
)
)
)


I am trying to get "[kadastralegrootte] => 5340", and than only the "5340" part.



I have tried something like this:



$json = json_decode($result, true);    
$grootte = $json->features->properties->kadastralegrootte;
echo "$grootte";


Where $result is a json file.
So far no luck. I would really appreciate it if someone took a look.










share|improve this question















This question already has an answer here:




  • How do I extract data from JSON with PHP?

    4 answers




I am trying to get a string out of an array, that I receive from an external API, but so far i haven't had any luck.



This is the array:



stdClass Object 
(
[type] => FeatureCollection
[totalFeatures] => 1
[features] => Array
(
[0] => stdClass Object
(
[type] => Feature
[id] => perceel.4304705
[geometry] => stdClass Object
(
[type] => Polygon
[coordinates] => Array
(
[0] => Array
(
[0] => Array
(
[0] => 135608.866
[1] => 444767.317
)
[1] => Array
(
[0] => 135638.627
[1] => 444759.41
)
[2] => Array
(
[0] => 135640.736
[1] => 444758.912
)
[3] => Array
(
[0] => 135642.048
[1] => 444758.752
)
[4] => Array
(
[0] => 135643.376
[1] => 444758.88
)
[5] => Array
(
[0] => 135644.544
[1] => 444759.104
)
[6] => Array
(
[0] => 135645.568
[1] => 444759.552
)
[7] => Array
(
[0] => 135646.512
[1] => 444760.064
)
[8] => Array
(
[0] => 135647.472
[1] => 444760.896
)
[9] => Array
(
[0] => 135648.176
[1] => 444761.664
)
[10] => Array
(
[0] => 135648.72
[1] => 444762.464
)
[11] => Array
(
[0] => 135649.136
[1] => 444763.552
)
[12] => Array
(
[0] => 135650.208
[1] => 444766.528
)
[13] => Array
(
[0] => 135653.968
[1] => 444777.568
)
[14] => Array
(
[0] => 135654.464
[1] => 444779.36
)
[15] => Array
(
[0] => 135660.672
[1] => 444802.784
)
[16] => Array
(
[0] => 135667.088
[1] => 444826.912
)
[17] => Array
(
[0] => 135669.351
[1] => 444835.724
)
[18] => Array
(
[0] => 135673.947
[1] => 444852.99
)
[19] => Array
(
[0] => 135680.226
[1] => 444851.14
)
[20] => Array
(
[0] => 135687.926
[1] => 444871.704
)
[21] => Array
(
[0] => 135688.078
[1] => 444872.023
)
[22] => Array
(
[0] => 135688.056
[1] => 444872.376
)
[23] => Array
(
[0] => 135687.892
[1] => 444872.648
)
[24] => Array
(
[0] => 135687.665
[1] => 444872.796
)
[25] => Array
(
[0] => 135681.376
[1] => 444874.368
)
[26] => Array
(
[0] => 135638.985
[1] => 444885.681
)
[27] => Array
(
[0] => 135624.48
[1] => 444831.424
)
[28] => Array
(
[0] => 135619.072
[1] => 444811.2
)
[29] => Array
(
[0] => 135613.504
[1] => 444790.432
)
[30] => Array
(
[0] => 135607.894
[1] => 444768.679
)
[31] => Array
(
[0] => 135608.866
[1] => 444767.317
)
)
)
)
[geometry_name] => begrenzingperceel
[properties] => stdClass Object
(
[lokaalID] => 340113504
[logischtijdstipOntstaan] => 2009-03-27T23:59:59.000
[logischtijdstipVervallen] =>
[kadastraleGemeenteCode] => VAN00
[sectie] => B
[kadastralegrootte] => 5340
[perceelnummer] => 3857
[perceelnummer_rotatie] => 0
[perceelnummer_deltax] => 0
[perceelnummer_deltay] => 0
[plaatscoordinaten] => stdClass Object
(
[type] => Point
[coordinates] => Array
(
[0] => 135644.749
[1] => 444828.56
)
)
)
)
)
[crs] => stdClass Object
(
[type] => name
[properties] => stdClass Object
(
[name] => urn:ogc:def:crs:EPSG::28992
)
)
)


I am trying to get "[kadastralegrootte] => 5340", and than only the "5340" part.



I have tried something like this:



$json = json_decode($result, true);    
$grootte = $json->features->properties->kadastralegrootte;
echo "$grootte";


Where $result is a json file.
So far no luck. I would really appreciate it if someone took a look.





This question already has an answer here:




  • How do I extract data from JSON with PHP?

    4 answers








php arrays json






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 17:52









DogantrDogantr

73




73




marked as duplicate by Paul php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 15 '18 at 20:14


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Paul php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 15 '18 at 20:14


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1





    Can you give us the json string? so we can decode it and try to help you, but give us the json encoded string please

    – Luis Cabrera Benito
    Nov 15 '18 at 18:17














  • 1





    Can you give us the json string? so we can decode it and try to help you, but give us the json encoded string please

    – Luis Cabrera Benito
    Nov 15 '18 at 18:17








1




1





Can you give us the json string? so we can decode it and try to help you, but give us the json encoded string please

– Luis Cabrera Benito
Nov 15 '18 at 18:17





Can you give us the json string? so we can decode it and try to help you, but give us the json encoded string please

– Luis Cabrera Benito
Nov 15 '18 at 18:17












2 Answers
2






active

oldest

votes


















0














After looking your code sample here at https://justpaste.it/6u9le I think you can do it by two different ways e.g decoding it as an array and access with bracket notation OR decode it as an object but then you've to access it using arrow operator ->. Hope that helps :)



// decode it as array
$json = json_decode($result,1); // using 2nd parameter true
$grootte = $json['features'][0]['properties']['kadastralegrootte'];
echo "$grootte";

// decode it as object
$json = json_decode($result); // not using 2nd parameter
$grootte = $json->features[0]->properties->kadastralegrootte;
echo "$grootte";





share|improve this answer


























  • Did not work :(

    – Dogantr
    Nov 15 '18 at 18:06











  • @Dogantr post the $result, I can make a workable demo for you :)

    – Always Sunny
    Nov 15 '18 at 18:15











  • That would really help me! here is a link justpaste.it/6u9le

    – Dogantr
    Nov 15 '18 at 19:10








  • 1





    @Dogantr this should be the accepted anser

    – Sarah Riddell
    Nov 16 '18 at 9:17











  • @Dogantr I've EDITED my answer after looking your share code on that link. Have a look again :)

    – Always Sunny
    Nov 16 '18 at 15:52



















1














what about?



$json = json_decode($result, true);    
$val= $json["features"][0]["geometry"]["properties"]["kadastralegrootte"];
echo "$val";


Edit after you gave me the json string:



$data = json_decode($result);
$value = $data->features[0]->properties->kadastralegrootte;
echo $value;


I just remove the true second argument, so it returns an object. Try it:
https://repl.it/@parzibyte/OlivedrabEnormousCosmos






share|improve this answer


























  • doesn't seem to work

    – Dogantr
    Nov 15 '18 at 19:15











  • @Dogantr I have updated my answer. Check it

    – Luis Cabrera Benito
    Nov 15 '18 at 19:28











  • thank you very much, it works!

    – Dogantr
    Nov 15 '18 at 19:39


















2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














After looking your code sample here at https://justpaste.it/6u9le I think you can do it by two different ways e.g decoding it as an array and access with bracket notation OR decode it as an object but then you've to access it using arrow operator ->. Hope that helps :)



// decode it as array
$json = json_decode($result,1); // using 2nd parameter true
$grootte = $json['features'][0]['properties']['kadastralegrootte'];
echo "$grootte";

// decode it as object
$json = json_decode($result); // not using 2nd parameter
$grootte = $json->features[0]->properties->kadastralegrootte;
echo "$grootte";





share|improve this answer


























  • Did not work :(

    – Dogantr
    Nov 15 '18 at 18:06











  • @Dogantr post the $result, I can make a workable demo for you :)

    – Always Sunny
    Nov 15 '18 at 18:15











  • That would really help me! here is a link justpaste.it/6u9le

    – Dogantr
    Nov 15 '18 at 19:10








  • 1





    @Dogantr this should be the accepted anser

    – Sarah Riddell
    Nov 16 '18 at 9:17











  • @Dogantr I've EDITED my answer after looking your share code on that link. Have a look again :)

    – Always Sunny
    Nov 16 '18 at 15:52
















0














After looking your code sample here at https://justpaste.it/6u9le I think you can do it by two different ways e.g decoding it as an array and access with bracket notation OR decode it as an object but then you've to access it using arrow operator ->. Hope that helps :)



// decode it as array
$json = json_decode($result,1); // using 2nd parameter true
$grootte = $json['features'][0]['properties']['kadastralegrootte'];
echo "$grootte";

// decode it as object
$json = json_decode($result); // not using 2nd parameter
$grootte = $json->features[0]->properties->kadastralegrootte;
echo "$grootte";





share|improve this answer


























  • Did not work :(

    – Dogantr
    Nov 15 '18 at 18:06











  • @Dogantr post the $result, I can make a workable demo for you :)

    – Always Sunny
    Nov 15 '18 at 18:15











  • That would really help me! here is a link justpaste.it/6u9le

    – Dogantr
    Nov 15 '18 at 19:10








  • 1





    @Dogantr this should be the accepted anser

    – Sarah Riddell
    Nov 16 '18 at 9:17











  • @Dogantr I've EDITED my answer after looking your share code on that link. Have a look again :)

    – Always Sunny
    Nov 16 '18 at 15:52














0












0








0







After looking your code sample here at https://justpaste.it/6u9le I think you can do it by two different ways e.g decoding it as an array and access with bracket notation OR decode it as an object but then you've to access it using arrow operator ->. Hope that helps :)



// decode it as array
$json = json_decode($result,1); // using 2nd parameter true
$grootte = $json['features'][0]['properties']['kadastralegrootte'];
echo "$grootte";

// decode it as object
$json = json_decode($result); // not using 2nd parameter
$grootte = $json->features[0]->properties->kadastralegrootte;
echo "$grootte";





share|improve this answer















After looking your code sample here at https://justpaste.it/6u9le I think you can do it by two different ways e.g decoding it as an array and access with bracket notation OR decode it as an object but then you've to access it using arrow operator ->. Hope that helps :)



// decode it as array
$json = json_decode($result,1); // using 2nd parameter true
$grootte = $json['features'][0]['properties']['kadastralegrootte'];
echo "$grootte";

// decode it as object
$json = json_decode($result); // not using 2nd parameter
$grootte = $json->features[0]->properties->kadastralegrootte;
echo "$grootte";






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 16 '18 at 15:51

























answered Nov 15 '18 at 17:57









Always SunnyAlways Sunny

16.8k32848




16.8k32848













  • Did not work :(

    – Dogantr
    Nov 15 '18 at 18:06











  • @Dogantr post the $result, I can make a workable demo for you :)

    – Always Sunny
    Nov 15 '18 at 18:15











  • That would really help me! here is a link justpaste.it/6u9le

    – Dogantr
    Nov 15 '18 at 19:10








  • 1





    @Dogantr this should be the accepted anser

    – Sarah Riddell
    Nov 16 '18 at 9:17











  • @Dogantr I've EDITED my answer after looking your share code on that link. Have a look again :)

    – Always Sunny
    Nov 16 '18 at 15:52



















  • Did not work :(

    – Dogantr
    Nov 15 '18 at 18:06











  • @Dogantr post the $result, I can make a workable demo for you :)

    – Always Sunny
    Nov 15 '18 at 18:15











  • That would really help me! here is a link justpaste.it/6u9le

    – Dogantr
    Nov 15 '18 at 19:10








  • 1





    @Dogantr this should be the accepted anser

    – Sarah Riddell
    Nov 16 '18 at 9:17











  • @Dogantr I've EDITED my answer after looking your share code on that link. Have a look again :)

    – Always Sunny
    Nov 16 '18 at 15:52

















Did not work :(

– Dogantr
Nov 15 '18 at 18:06





Did not work :(

– Dogantr
Nov 15 '18 at 18:06













@Dogantr post the $result, I can make a workable demo for you :)

– Always Sunny
Nov 15 '18 at 18:15





@Dogantr post the $result, I can make a workable demo for you :)

– Always Sunny
Nov 15 '18 at 18:15













That would really help me! here is a link justpaste.it/6u9le

– Dogantr
Nov 15 '18 at 19:10







That would really help me! here is a link justpaste.it/6u9le

– Dogantr
Nov 15 '18 at 19:10






1




1





@Dogantr this should be the accepted anser

– Sarah Riddell
Nov 16 '18 at 9:17





@Dogantr this should be the accepted anser

– Sarah Riddell
Nov 16 '18 at 9:17













@Dogantr I've EDITED my answer after looking your share code on that link. Have a look again :)

– Always Sunny
Nov 16 '18 at 15:52





@Dogantr I've EDITED my answer after looking your share code on that link. Have a look again :)

– Always Sunny
Nov 16 '18 at 15:52













1














what about?



$json = json_decode($result, true);    
$val= $json["features"][0]["geometry"]["properties"]["kadastralegrootte"];
echo "$val";


Edit after you gave me the json string:



$data = json_decode($result);
$value = $data->features[0]->properties->kadastralegrootte;
echo $value;


I just remove the true second argument, so it returns an object. Try it:
https://repl.it/@parzibyte/OlivedrabEnormousCosmos






share|improve this answer


























  • doesn't seem to work

    – Dogantr
    Nov 15 '18 at 19:15











  • @Dogantr I have updated my answer. Check it

    – Luis Cabrera Benito
    Nov 15 '18 at 19:28











  • thank you very much, it works!

    – Dogantr
    Nov 15 '18 at 19:39
















1














what about?



$json = json_decode($result, true);    
$val= $json["features"][0]["geometry"]["properties"]["kadastralegrootte"];
echo "$val";


Edit after you gave me the json string:



$data = json_decode($result);
$value = $data->features[0]->properties->kadastralegrootte;
echo $value;


I just remove the true second argument, so it returns an object. Try it:
https://repl.it/@parzibyte/OlivedrabEnormousCosmos






share|improve this answer


























  • doesn't seem to work

    – Dogantr
    Nov 15 '18 at 19:15











  • @Dogantr I have updated my answer. Check it

    – Luis Cabrera Benito
    Nov 15 '18 at 19:28











  • thank you very much, it works!

    – Dogantr
    Nov 15 '18 at 19:39














1












1








1







what about?



$json = json_decode($result, true);    
$val= $json["features"][0]["geometry"]["properties"]["kadastralegrootte"];
echo "$val";


Edit after you gave me the json string:



$data = json_decode($result);
$value = $data->features[0]->properties->kadastralegrootte;
echo $value;


I just remove the true second argument, so it returns an object. Try it:
https://repl.it/@parzibyte/OlivedrabEnormousCosmos






share|improve this answer















what about?



$json = json_decode($result, true);    
$val= $json["features"][0]["geometry"]["properties"]["kadastralegrootte"];
echo "$val";


Edit after you gave me the json string:



$data = json_decode($result);
$value = $data->features[0]->properties->kadastralegrootte;
echo $value;


I just remove the true second argument, so it returns an object. Try it:
https://repl.it/@parzibyte/OlivedrabEnormousCosmos







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 15 '18 at 19:27

























answered Nov 15 '18 at 18:16









Luis Cabrera BenitoLuis Cabrera Benito

795512




795512













  • doesn't seem to work

    – Dogantr
    Nov 15 '18 at 19:15











  • @Dogantr I have updated my answer. Check it

    – Luis Cabrera Benito
    Nov 15 '18 at 19:28











  • thank you very much, it works!

    – Dogantr
    Nov 15 '18 at 19:39



















  • doesn't seem to work

    – Dogantr
    Nov 15 '18 at 19:15











  • @Dogantr I have updated my answer. Check it

    – Luis Cabrera Benito
    Nov 15 '18 at 19:28











  • thank you very much, it works!

    – Dogantr
    Nov 15 '18 at 19:39

















doesn't seem to work

– Dogantr
Nov 15 '18 at 19:15





doesn't seem to work

– Dogantr
Nov 15 '18 at 19:15













@Dogantr I have updated my answer. Check it

– Luis Cabrera Benito
Nov 15 '18 at 19:28





@Dogantr I have updated my answer. Check it

– Luis Cabrera Benito
Nov 15 '18 at 19:28













thank you very much, it works!

– Dogantr
Nov 15 '18 at 19:39





thank you very much, it works!

– Dogantr
Nov 15 '18 at 19:39



Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python