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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:48:02+00:00 2026-05-27T10:48:02+00:00

Im new to json and c# and need help in the right direction. Look

  • 0

Im new to json and c# and need help in the right direction.
Look at the picture down below and you see the json string looking funny with slashes.

How can i remove the slashes or what parser should i use if this is wrong

This is my C# code:

 PostList p = new PostList();

 Posts posts1 = new Posts();
 posts1.username = "aaaa";
 posts1.message = "hej again";
 posts1.time = "time1";
 p.setPost(posts1);

 Posts posts2 = new Posts();
 posts2.username = "bbbb";
 posts2.message = "hej again again";
 posts2.time = "time2";
 p.setPost(posts2);

 Posts posts3 = new Posts();
 posts3.username = "cccc";
 posts3.message = "hej again again agin";
 posts3.time = "time3";
 p.setPost(posts3);
 System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(p.GetType());
 MemoryStream ms = new MemoryStream();
 serializer.WriteObject(ms, p);
 string json = Encoding.Default.GetString(ms.ToArray());

This is my class that i try to serialize

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.Specialized;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;

namespace Project2
{
    [DataContract]
    public class PostList
    {
        [DataMember]
        private List<Posts> posts { get; set; } 

        public PostList(){

            this.posts = new List<Posts>();
        }


        public List<Posts> getPostContainterList()
        {
            return posts;
        }

        public void setPost(Posts post)
        {
            posts.Add(post);
        }
    }

    [DataContract]
    public class Posts
    {
        [DataMember]
        public String message { get; set; }

        [DataMember]
        public String time { get; set; }

        [DataMember]
        public String username { get; set; }
    }
}

enter image description here

UPDATE SHOWING WHERE STRING COME FROM
enter image description here

  • 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-27T10:48:03+00:00Added an answer on May 27, 2026 at 10:48 am

    Hit your service with something like Fiddler / Chrome tools / IE f12 developer tools to see the raw response. I suspect that your JSON is actually fine, and that the slashes are added by the JSON viewer you use.

    If ur new to JSON,a great quick resource for pasting in long JSON strings and seeing them hierarchically is jsonlint.com . It validates them too.

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

Sidebar

Related Questions

I'm new with json, and I need your help please. I received JSON string
I am pretty new to YUI and need some help. I have a JSON
I am completely new to Javascript/jquery world and need some help. Right now, I
Im new to JSON and php. I need to grab the lat and lng
I'm new with JSON.NET and I'm trying to deserialize a JSON string to a
I’m new to android,I have an activity class which fetches Json string from url
Sorry, guys.I am quite new in mysql but I do need help from getting
Need help on android. Been having this error Error Parsing data org.json.JSONException: Value <html>
I need some help in picking the 'right' solution for the following 'problem'. I
I need some help with my web service and json call.. stuck trying to

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.