Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2013
    Posts
    48
    Thanks
    9
    Thanked 1 Time in 1 Post

    Get elements of JSON except first one

    Title is clear enough. I have JSON and i want to get all of the elements of specific directory, except first one.
    Code:
    "columns":
    		[{"name":"Language"},
    		{"name":"Speakers_2008"},
    		{"name":"Speakers_2009"},
    		{"name":"Speakers_2010"}]},

  • #2
    Regular Coder
    Join Date
    May 2012
    Location
    France
    Posts
    224
    Thanks
    0
    Thanked 32 Times in 30 Posts
    See the splice method. To remove the first element of an array (I suppose columns is a field of your JSON Object):
    Code:
    var myArray=myJsonObj.columns;
    myArr.splice(0,1); // return the first object and remove its from myArray
    Last edited by 007julien; 08-16-2013 at 05:36 PM.

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,297
    Thanks
    10
    Thanked 584 Times in 565 Posts
    use columns.slice(1) to grab all but the first
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •