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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:58:30+00:00 2026-05-13T09:58:30+00:00

Design question for RESTful APIs: one of the input parameters to my API (that

  • 0

Design question for RESTful APIs: one of the input parameters to my API (that is, the data sent from the client to my API) is a dictionary (hash / key-value pairs). What’s the best way to encode this so that the API can be easily invoked from web pages as well as scripts/programming languages?

My first thought was to json encode the object, something like this:

var data = {a:'one', b:'two'};
form_paramter_x = JSON.stringify(data);

and decode on the server:

data = simplejson.loads( request.POST['form_paramter_x'] )

The alternative would be to encode as key-value pairs html-form-checkbox style:

form_param_x=a:one&form_param_x=b:two

The latter alternative would require ad-hoc parsing of the key and value (the “a:one” part), and generally seems less clean, but also seems closer to a basic HTML form, which is probably a good thing.

Which of these is cleaner? Or is there another better alternative?

  • 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-13T09:58:31+00:00Added an answer on May 13, 2026 at 9:58 am

    If you’re designing your API for other parties to use, I’d consider what is going to be easiest for them to encode for. JSON is widely supported these days, so that isn’t a deal breaker. In the end, I’d go w/ whichever is easier for your clients to code. Emotionally, I’m leaning towards the JSON encoding.

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

Sidebar

Related Questions

Another design question for you If I have 5 activities that can result from
I am designing a Restful HTTP API and have a design question. In my
A design question: I'd like to build a Windows service that executes different commands
This is a design question, I noticed that by time by LINQ-to-SQL Context gets
Java design question. I have an object that needs to maintain sets of say
Quick design question: I need to implement a form of communication between a client-server
I am asking a design question . Assume that there is a class in
I've got an app design question that I'm hoping someone can help with. Let's
This is a design question, rather than a technical one. General case : I
My Question is a design question. Should I use a StringBuilder and read the

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.