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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:23:48+00:00 2026-05-30T14:23:48+00:00

I am using WCF Web API service to publish some data via Json and

  • 0

I am using WCF Web API service to publish some data via Json and Xml. But I have a problem with html string to serialize it.

for Xml serialize I use XmlMediaTypeFormatter() and
for Json serialize I have CustomJSONMediaTypeFormatter class which uses Newtonsoft.Json library.

I get data with Entity framework from database, and like code bellow I publish it with WCF web api service.

    [WebGet(UriTemplate = "getLogin")]
    public IQueryable<LoginTableDTO> Login()
    {
         var loginList = ltr.GetList();
        List<LoginTableDTO> dtoList = new List<LoginTableDTO>();
        foreach (LoginTable item in loginList)
        {
            dtoList.Add(LoginTableAssembler.ToDTO(item));
        }
    return dtoList.AsQueryable();
}

but with html strings like

<p><input style="float: right" type="submit" name="name" value="Save Changes" /></p>

which are coming from database, after serialize returns

&lt;p&gt;&lt;input style="float: right" type="submit" name="name" value="Save Changes" /&gt;&lt;/p&gt;

for xml and returns

\u003cp\u003e\u003cinput style=\"float: right\" type=\"submit\" name=\"name\" value=\"Save Changes\" /\u003e\u003c/p\u003e

for Json.

As you see they are not human readable.

I also have some problem with datetime object. but I found a solution to convert string before doing that prosses actually, I am not happy with it.(thats another issue).

What should I do for serializing HTML strings like normal strings (which are not have “html tags”) to XML and JSON?

Thanks in advance…

  • 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-30T14:23:50+00:00Added an answer on May 30, 2026 at 2:23 pm

    I’m not 100% sure what you want but if you want:

    &lt;p&gt;&lt;input style="float: right" type="submit" name="name" value="Save Changes" /&gt;&lt;/p&gt;
    

    to become:

    <p><input style="float: right" type="submit" name="name" value="Save Changes" /></p>
    

    use http://msdn.microsoft.com/en-us/library/7c5fyk1k.aspx. The problem is that you’ll need to escape the HTML to save it to XML….meaning I think the string below looks right.

    \u003cp\u003e\u003cinput style=\"float: right\" type=\"submit\" name=\"name\" value=\"Save Changes\" /\u003e\u003c/p\u003e
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am exploring the idea of implementing a web service api using WCF Data
I have developed a Web service using WCF Service Application. This service application is
I have a .NET web service (using asmx...have not upgraded to WCF yet) that
I'm using WCF Web API to create a self-hosted/InProcess REST Service (HttpServiceHost) that the
I have several resources that I'd like to expose using the WCF Web API.
I am having problems consuming a WCF web service (PaySimple's v3.00 API) using php
Hi We developed web service using WCF service and hosted on Windows 2003 server
I am using calling web services and using WCF generated service-reference on the client.
I am building a Web service using WCF as a way to provide access
I'm trying to build a generic web service interface using WCF, to allow 3rd

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.