RestSharp AddBody adding double quote in JSON parameter

RestSharp AddBody adding double quote in JSON parameter

I am calling API with RESTSharp

I am calling API with RESTSharp

  var client = new RestClient("http://demoservice.com");
  var request = new RestRequest("callapi", "put");          
  request.RequestFormat = DataFormat.Json;

string jsonaction = "{"tokenid":"x123x45","userid":"2456","ip":"192.168.1.20","transaction":"6","actionCode":"78","jtoken":"systemtoken"}"; request.AddBody(new { action = "SAVE", data = "savedata", token = "systemtoken", jsonaction = jsonaction });

I am checking in debug data passing in request. and my expected output as follows

{"action":"SAVE","data":"savedata","token":"systemtoken","jsonaction":{"tokenid":"x123x45","userid":"2456","ip":"192.168.1.20","transaction":"6","actionCode":"78","jtoken":"systemtoken"}}

But getting

{"action":"SAVE","data":"savedata","token":"systemtoken","jsonaction":"{"tokenid":"x123x45","userid":"2456","ip":"192.168.1.20","transaction":"6","actionCode":"78","jtoken":"systemtoken"}"}

If anybody can guide how to post for JSON I have tried with Addbody and AddJsonBody but nothing works.

c-sharp json web-service

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Web Services - Demystified!

In this video, I explain web services. What are web services? How do they work? The technologies involved and all you need to know about web services. I talk about SOAP web services. REST web services, XML, JSON, etc. I also explain distributed programming and explain how it relates to web services. FInally, I list the technologies and things you need to know to use web services.

C. C++. C#. 차이점 알려드림. 5분 순삭. Explain C.C++.C#. Like I'm Five

C. C++. C#. 차이점 알려드림. 5분 순삭. Explain C.C++.C#. Like I'm Five. 아시죠? C는 C++.C# 줄인말이 아니라는거?

Dicey Issues in C/C++

C/C++ problems. If you are familiar with C/C++then you must have come across some unusual things and if you haven’t, then you are about to. The below codes are checked twice before adding, so feel free to share this article with your friends.

Learn how to perform CRUD operations using C Sharp

QuickStart: CRUD Operations in C Sharp. Learn how to perform CRUD operations using C Sharp for MongoDB databases.

Mapping JSON to and from a C++ Structure

Full tutorial on how to map JSON to and from a C++ structure—including installation, usage, and exceptions. Mapping JSON to and from a C++ Structure. StructMapping is a header-only C++ library. All library files are in the include folder.