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

  • Home
  • SEARCH
  • 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 9005689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:12:41+00:00 2026-06-16T01:12:41+00:00

So, I found that making my WebMethod As Object, Return Dictionary rather than As

  • 0

So, I found that making my WebMethod As Object, Return Dictionary rather than As String, Return JavaScriptSerializer.Serialized() reduces the size of the JSON by ~ 20%.

Yeah, I know this isn’t a big deal for traditional webapps where you’re serving the consumer (in the past) and a few kb would be big, but it’s HUGE for B2B where you’re trying to serve up to your customers AJAXd jQuery pages with far less data transmission and greater speed when transmitting dynamic tables that could be potentially 100mb before dynamicization and id lists of about 1-2mb, but I digress.

It looks like json_encode does the same thing adding more than necessary to the JSON, from what I’ve read on other posts. Is there a way to simply output the array as an object or build an object from multiple arrays and export that?

1) Is print (and its’ family) the only way to output?

2) Is json_encode (and its’ family) necessary? After all, I don’t have to decode if I output properly at the jQuery level.

I’m a big fan of speed & efficiency. As AJAX/jsLibs take over, and data becomes bigger while these hunkering server-side scripts go by the wayside, it looks like the next logical objective (aside from a standardized push to client) is to keep the size of the JSON as small as possible.

How can I keep the garbage with AJAX/PHP down to a mininum? How can I export arrays as object directly?

Thanks for bearing with me. I’m terrible with vocabulary. I hope what I want to do is relatively clear enough.

As always, thanks in advance, and thank you stack for being my brain!

  • 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-16T01:12:42+00:00Added an answer on June 16, 2026 at 1:12 am

    The problem I was having with .net webmethod was that I was javascriptserializing my output before sending it out with <ScriptMethod(ResponseFormat:=ResponseFormat.Json)> included. That’s what added the extra data to my json output.

    Arrays can be exported as is with json_encode, and that’s all that’s needed.

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

Sidebar

Related Questions

I am making a new application in MongoDB, and I have found that the
I found that HTMLOptionsCollection object inherits properties and methods from HTMLCollection. HTMLOptionsCollections->HTMLCollection->Object->null Is there
I found that making a table with <table style=padding-left: 100px; width: 200px> makes the
I have found that when making an ajax call, the URL appears to be
This is more of a sanity check than anything else. I've found that when
I found that I should be using Reset CSS file for making websites, but
I found that, WebView control (For Windows 8 Metro style app) is the one
I found that when I use HttpWebRequest to establish SSL\TLS connection, it takes near
I found that in the cocos2d Best Practices there is a suggestion to use
I found that my project sets GCC_NO_COMMON_BLOCKS = NO under Apple LLVM Compiler 3.1

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.