Sending JSON objects from Native Messaging

Confirmed Issue #13285321 • Assigned to Mahesh J.


Greg D.
Aug 16, 2017
This issue is public.
Found in
  • Microsoft Edge
Found in build #
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce

How do you send an object with multiple values, rather than just a string?

Unfortunately the C#/C++ examples only show sending a single string value, as message or response.

I’ve managed sending a value from native messaging UWP AppService

            ValueSet valueSet = new ValueSet();
            valueSet.Add("Anything here?", "Text here");
            await connection.SendMessageAsync(valueSet);

In Edge extension background script gets String value "Text here", makes sense as a string was sent.

In Chrome/Firefox because of text based stream, you serialize the object, so tried the same for Edge

            Dictionary<string, object> result = new Dictionary<string, object>
                        { "Command", "BRIDGE NOT AVAILABLE" },
                        { "NoResult", true }

            ValueSet valueSet = new ValueSet();
            valueSet.Add("message", JsonConvert.SerializeObject(result, Formatting.Indented));
            await connection.SendMessageAsync(valueSet);

But here the string wasn’t parsed back into an object, but left as a string.

recieved message from native app: message:  {
  "NoResult": true

In Chrome/Firefox this is an object parsed from the stream.

I also tried sending a ValueSet hoping for object, but it didn’t even show up in the console log, not sure where it went.

            ValueSet valueSet = new ValueSet();
            valueSet.Add("Command", "getUrl");
            ValueSet msg = new ValueSet();
            msg.Add("Message", valueSet);
            await connection.SendMessageAsync(valueSet);


0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Title from “Sending JSON objects from Native Messaging” to “Sending JSON objects from Native Messaging”

      Changed Assigned To to “Rahul R.”

    • It seems that this issue is same as the one I reported in the following ticket.

    • Thanks @Anon yes it does seem to be the same issue.

    • Microsoft Edge Team

      Changed Status to “Confirmed”

      Changed Status from “Confirmed”

      Changed Status to “Confirmed”

      Changed Assigned To from “Rahul R.” to “Mahesh J.”

    You need to sign in to your Microsoft account to add a comment.

    Sign in