How can I pass a JSON object from CefSharp's ChromiumWebBrowser to JavaScript without converting it to a string?

browser.JavascriptObjectRepository.Register("BrowerFunc", new BrowerFunc(), isAsync: false, options: bo);
 public class BrowerFunc
        {
            public string readIniData(string Section, string iniFilePath) {
                string Contentjson = JsonConvert.SerializeObject(OperateIniFile.ReadIniDataAll(Section, iniFilePath));
                return Contentjson;
            }

        }

I am looking to modify the 'readIniData' method to return a json object instead of a json string.

I attempted to return Dictionary, but encountered some exceptions:

Uncaught Error: System.ServiceModel.CommunicationException: Pipe read error: Pipe has been ended. (109, 0x6d). ---> System.IO.PipeException: Pipe read error: Pipe has been ended. (109, 0x6d).
   at ...
   ... 
   ... 

Server stack trace: 
   at ...

Exception rethrown at [0]: 
   at ...

My CefSharp version is 79.1.360.0, could this version be too outdated?</p>

Answer №1

One way to accomplish this is by utilizing Json.Net.

var jsonData = JObject.Parse(data)
;

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Retrieving the value from a dynamically-generated dropdown menu using jQuery

I created a tree list of data and I am attempting to update some information that is stored in a select element by sending a JSON post request to the edit action. Despite trying multiple approaches with jQuery, myself and my colleagues have been unsuccessf ...

Notification continuously appears when clicking outside of Chrome

I have implemented the use of onblur on a text box to display an alert. However, I encountered an issue where if I click outside my Chrome browser after entering text in the text box and then click on the Chrome browser button in the task bar, the alert ap ...

Transitioning from jQuery to AngularJS functions

I'm new to writing a jQuery function within AngularJs and could use some guidance. Any suggestions on the best approach for achieving this? Appreciate it! $(function() { $('.input input').focus(function() { $(this).parent('.in ...

Determine the position and quantity of elements in jQuery by comparing their IDs with the current page or element

Looking to retrieve the n (zero based) position of an element by matching the page and element ID... Let's use an example (Assume the current page ID is 488); <ul id="work-grid"> <li id="item-486" class="work-item"><!--/content--& ...

Event handler class fails to determine the checkbox status

I am attempting to bind the change event of certain checkboxes by class and then check whether the checkbox is being checked or unchecked for further processing. However, I am facing an issue where the "nope" alert always pops up, regardless of the checkbo ...

Could it be premature to transition from .NET Core 2.2 to .NET Core 3.0 at this time?

I'm considering upgrading my project to .Net Core 3.0, but as I review the migration guide found at https://learn.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.0&tabs=visual-studio I've noticed that there are potentia ...

Error: Failed to set the 'src' property of null when attempting to change the image source

When I click on an image, I want to change its source. Here is the HTML code: <div class="character"> <input id="1200" name="vocation_select" type="radio" value="1200" style="display: none" ></input> <label id="label_profesji" for="12 ...

Using JavaScript, verify if a textbox is blank when utilizing the AJAX Control Toolkit's TextBoxWatermark feature

I am currently utilizing the AjaxControlToolkit's TextBoxWatermark feature with an asp.net TextBox to display placeholder text when the box is empty. However, I have encountered an issue where on the client click of a specific button, I need to check ...

How come my uploaded Excel Javascript add-on opens in an external browser instead of the task pane?

Note: It has come to my attention that I must save the taskpane.html file on my local drive before it opens in an external browser. This detail slipped my notice last week. I am currently developing a Javascript, or rather Typescript, API add-in for Excel ...

What is a reliable method for consistently updating backend C# with user-side JS data whenever it is altered?

I'm working on a front end JS application that includes visual sliders. I need to send the updated slider information to the C# backend (ASP.NET) whenever a user makes changes. After some research, it seems like AJAX is the most efficient way to achie ...

What are some ways to design unique custom data grid toolbar elements?

I am having trouble syncing my custom toolbar buttons with the imported material data grid toolbar components. I would like them to match in style, specifically applying the material styles to my custom components. However, I have not been able to find a w ...

Exploring the functionality of $scope.$watch in ES6

I'm encountering a problem while utilizing $scope.$watch in my ES6 project. The watch triggers once and then doesn't work thereafter. Below is the snippet of code: export class SomeController { constructor($log, $scope) { 'ngInject&a ...

Error received when attempting AJAX call with jQuery 1.7.2: NS_ERROR_XPC_NOT_ENOUGH_ARGS

Encountering an issue with jQuery version 1.7.2 and the ajax function. When running the code snippet below, Firefox Firebug console displays the following error: NS_ERROR_XPC_NOT_ENOUGH_ARGS: Not enough arguments [nsIDOMLocation.replace] var wei ...

What is the rationale for storing referenced dynamic link libraries (DLLs) alongside the executable

I'm struggling to understand why a DLL is copied into the folder with the exe that references it. My understanding was that the purpose of creating a DLL is for reusable code. So, if I create a DLL that is used by 25 applications (for its "reusable co ...

"Step-by-Step Guide: Integrate Cloudinary Upload Widget with Angular Framework

Struggling with integrating the Cloudinary Upload Widget into my Angular project. I followed the example code provided by Cloudinary, but it's not functioning as expected. It seems like there's a missing import or package needed to access the clo ...

Discovering the optimal angle and ballistics formula for calculating a projectile's trajectory in Three.js

Utilizing FlyControls.js for my camera perspective I am attempting to incorporate a projectile into my object The projectile is meant to utilize the angles between the camera position and the crosshair/reticle position, moving freely through 3D space My ...

Exploring Button Navigation Features in a Windows 8 Application

Hello, I am completely new to Windows 8 App Development and currently working on creating a Windows 8 App that requires a button click to navigate to another page. My app is being developed using HTML/CSS and Javascript. I have tried various methods like w ...

Ways to extract the coordinates for slices positioned around the circumference of a pie chart

Currently, I am working on designing a pie chart with D3 using d3.layout.pie(). The image resembles the one displayed below, but without the black dots. These dots were added manually in Photoshop to highlight an issue that I am facing. I am curious about ...

Utilize Angular, PHP, and MySQL to add data to database encountering error

Working with a controller to fetch records from a database table and bind them to textfields for insertion into another table. However, upon submission, encountering the following error: TypeError: Cannot read property 'resp_fname' of undefined ...

Issue with isset causing getjson to return null

I'm encountering an issue with my code. My goal is to validate a form by creating an array that holds a variable when the form is valid. To achieve this, I need to utilize the isset method to determine if the information has been posted. Here's a ...