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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:30:47+00:00 2026-06-03T15:30:47+00:00

I want to build a service that will pass the data read from the

  • 0

I want to build a service that will pass the data read from the database to the client in JSON format. I don’t know the schema table and the types.

I thought about implementing the WCF over Dictionary but the JSON is very complicated and contains objects like “key = …; value = …” and i want just “key=value” and i need to return list of Dictionary objects. Sometimes from database i will receive a comma separated array, so i will insert in my Dictionary a key with a new Dictionary as value.

In PHP my boss said that it can be done through associative arrays. Please help me with some ideas or link because i don’t know where to start to look.

If there is something that you didn’t understood please comment and i will try another explanation.

Edits:

  1. I need it to be a rest service, so JSON is mandatory.
  2. How can i load data from the table ? What type can i use ?

Edit #2 : This is what i want to get : CorectJSON

Edit #3 : This is my current json :

stdClass Object
(
    [areaGetStreetTypesResult] => stdClass Object
        (
            [responseMessage] => [{"name":"IMPASSE","street_type":"IMP"}{"name":"LOTISSEMENT","street_type":"LOT"}{"name":"ROUTE","street_type":"RTE"}{"name":"RUE","street_type":"RUE"}]
            [response_status] => stdClass Object
                (
                    [message] => Success : JSON created into the responseMessage variable !
                    [status] => 0
                )

        )

)

Is not containing some commas between so it cannot be decoded by php. What should i do ?

This is my method Code

  • 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-03T15:30:49+00:00Added an answer on June 3, 2026 at 3:30 pm

    What is the reason why you need to pass JSON? If you want to create a WCF REST service, it is sufficient to tell WCF to create JSON messages as described here: http://www.codeproject.com/Articles/327420/WCF-REST-Service-with-JSON

    If you access the service from a C# application, you don’t need to care about how data is passed back and forth. Just take “normal” method parameters and use return values like you’d do locally and you’re set.

    Example:

    string[] GetResultStrings(List<Rectangle> sourceRectangles);
    

    If you really need to pass JSON strings, just pass strings and use the JSON serializer and deserializer to encode the reply and decode the parameters.

    For example:

    string GetJSONString(string jsonRequest);
    

    The following information may help on using the JSON serializer and deserializer: http://www.codeproject.com/Articles/272335/JSON-Serialization-and-Deserialization-in-ASP-NET

    EDIT
    I’m using the following method to serialize serializable objects to JSON:

    public static string SerializeJSON(this object obj)
    {
        DataContractJsonSerializer serializer = new DataContractJsonSerializer(obj.GetType());
        using (MemoryStream ms = new MemoryStream())
        {
            serializer.WriteObject(ms, obj);
            return Encoding.UTF8.GetString(ms.ToArray());
        }
    }
    

    This works just fine for any DataContract class like:

    [DataContract]
    public class MyJSONReturnableClass
    {
        [DataMember]
        public string ThisBecomesANamedString;
    
        [DataMember]
        public MyJSONReturnableClass[] AndWorksAlsoForNestedArrays;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to build a windows service that will use a remote encoding service
Let's say I want to build a REST service for making notes that looks
I want to build an app that is basically a subscription service for text
I want to build an application that indexes files in a database. This database
I want to build some sort of interface that will monitor our real time
I have a app that parses all my data from my web service as
I want to build an API service using Django. A basic workflow goes like
I want to build a REST web service on app engine. Currently i have
I have a spring-based Web Service. I now want to build a sort of
We have build several web service based on .net. Now we want to create

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.