Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9292949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T21:00:29+00:00 2026-06-18T21:00:29+00:00

Hi i have a json file that looks like this: { links_1: [ {

  • 0

Hi i have a json file that looks like this:

{
"links_1": [
    {
        "navn": "somename",
        "link": "http://www.domane.com"
    },
    {
        "navn": "somename",
        "link": "http://www.domane.com"
    },
    {
        "navn": "somename",
        "link": "http://www.domane.com"
    }
],
"links_2": [
    {
        "navn": "someothername",
        "link": "http://www.domane.com"
    },
    {
        "navn": "someothername",
        "link": "http://www.domane.com"
    },
    {
        "navn": "someothername",
        "link": "http://www.domane.com"
    }
]   
}

Then i have my Collection class.
Now i want to create a new collection that only contains the links_1 array from the json file.
And another new collection that contains the links_2 array from the json file.

How do i accomplish that?

var col = new Collection( Collection.prototype.parse = function(response){
return response.links_1;
}

So to illustrate further, i want my fetch to get specific json data objects.

var col = new Collection();
col.fetch(links_1);  //  here i only want to get links_1 json data

var col2 = new Collection();
col2.fetch(links_2); //  here i only want to get links_2 json data

any help would be great.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T21:00:31+00:00Added an answer on June 18, 2026 at 9:00 pm

    You’re on the right track with trying to override parse, you’re just doing it incorrectly. Try:

    //define a collection class
    var Link1Collection = Backbone.Collection.extend({
      parse:function(response) {
        return response.links_1
      }
    });
    
    //initialize a new instance of your collection class and fetch
    var collection = new Link1Collection();
    collection.fetch();
    

    Edit: To select the field you want to extract on instance-to-instance basis, you can pass a custom option in the fetch options. The options are passed to parse:

    //define a collection class
    var LinkCollection = Backbone.Collection.extend({
      parse:function(response, options) {
        return options.parseField ? response[options.parseField] : response;
      }
    });
    
    //initialize a new instance of your collection class and fetch
    var collection = new LinkCollection();
    collection.fetch({parseField:'links_1'});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Json file that looks like this: [ { field:val }, ....
I have a manifest.json file that looks like this: { name: Zend Debugger Extension,
Ok..so i have a json string (myJson) that looks like this: {id: 1, file:
I have a json file that looks like this: { status: 200, data: {
I have a JSON object that looks like this. [ { id : 23,
Function cue.getCueAsSource(); gives me a nice and clean JSON file that looks like this:
I have an app file that looks like this ws_app.rb: require 'rubygems' require 'sinatra'
I have a generated JSON file that I would like to transform. Is there
If i have a php file that outputs json data with numerical keys, like
I have this swf (flash) file that provides the json that needs to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.