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 7405985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:29:12+00:00 2026-05-29T05:29:12+00:00

Thank you for taking the time to read this. I looked over Stack Overflow

  • 0

Thank you for taking the time to read this. I looked over Stack Overflow and didn’t see a similar question, but if I missed one I apologize.

So I’m building a RESTful API, along with a user interface that is the (first) consumer of said REST API.

I have a need to create an object. The creation of that object takes a decent amount of configuration.

I understand about the verb I need to use (POST – let’s not argue this point) and the URL path that I need to have. My question is about how to configure the parameters. Let me give you a sample configuration object in JSON format so as to be agnostic:

    { 
     name: "foo",
     barid:1, 
     features:[
        {
         id:1, 
         config: {
            foo:bar, 
            fubar:baz
         } 
        }, 
        {
         id:2, 
         config: {
            foo:bar, 
            fubar:baz
         }
        },... 
    ]  
   }

So what I’m wondering is this… what’s the correct way to POST the features parameter? Should I just make “features” a JSON string and deserialize it on the server side? Is there some convention that you follow to build an array of nested objects in a RESTful POST? Other developers are going to have to consume this, and I certainly don’t want people to have to hand-construct what jQuery did with my JSON object, which looked like:

features[0][featureid]:2
features[0][configuration][min]:-64
features[0][configuration][max]:50
features[0][include]:true
features[1][featureid]:3
features[1][configuration][min]:0
features[1][configuration][max]:80.5
features[1][include]:true

My grails app didn’t like that very much 🙂

Thanks again for your time.

  • 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-05-29T05:29:14+00:00Added an answer on May 29, 2026 at 5:29 am

    Grails can accept parameters like features[0].featured=2&features[0].configuration.min=-64, but you must prepare empty structures and features array before actual mapping. It would be:

    import org.apache.commons.collections.ListUtils
    import org.apache.commons.collections.Factory
    
    class DataCommand {
    
      String name
    
      List features = = ListUtils.lazyList([], {
          new FeatureCommand(
              configuration: new ConfigurationCommand()
          )
      } as Factory)
    
    }
    

    +

    class FeatureCommand {
        int featured
        ConfigurationCommand configuration
    }
    
    class ConfigurationCommand {
        int min
        int max
    }
    

    lazyList creates list elements on demand. If you know exactly amount of features – you can fill it manually w/o using lazyList.

    Btw, it’s also a good way to POST/PUT actual JSON in body to server, instead of request parameters. It’s default way of BackboneJS, for example. So you will be able to parse incoming JSON by yourself, of map to same commands (requires little configuration).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

and first of all, thank you for taking the time to read my question.
Hello and thank you for taking the time to read my question, I have
Thank you for taking the time to read this and I will appreciate every
Thank you for taking the time to read this and I will appreciate every
Thank you for taking the time to read this and I will appreciate every
Thank you for taking the time to read this and I will appreciate every
thank you for taking your time to read this message. I hope you are
Thanks for taking the time to read this. I have an unknown number of
Hello everyone and as usual, thank you to anyone taking the time to read
First of all, thanks for taking the time to read my question, I appreciate

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.