question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Send JSONObject as Bundle not working for Android

See original GitHub issue

I want to send a simple JSON object but the plugin was not able to convert it correctly to JSON

I want to send this simple JSON { "data":{ "testingkey":"testingValue" } }

So according to the documentation should be something like this

val bundle1 = Bundle()
bundle1.putString("testingkey", "testingValue")
val bundle2 = Bundle()
bundle2.putBundle("json", bundle1)
intent.putExtra("data",  bundle2)

After that in the listener when I put the log to see the response console.log(JSON.stringify(e, null, "\t"))

I got this: { "isTrusted": false, "data": "Bundle[{json=Bundle[{TestingKey=TestingValue}]}]" }

Note that I don’t want to send the JSON as string because if I try something like this:

intent.putExtra("data", jsont.toString())

I got this:

{ 
   "data":"{\"testingkey\":\"testingValue\"}"
}

So it appears that your plugin is supporting just one depth in the JSON Object

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bsorrentinocommented, Nov 10, 2019

fix released in 4.0.0

1reaction
bsorrentinocommented, Nov 8, 2019

hi @alejouribesanchez

So it would be great if the plugin is consistent across platforms

It must be, I’ll work on

Read more comments on GitHub >

github_iconTop Results From Across the Web

Passing JSONObject into another activity - Stack Overflow
I was thinking that I would be able to pass a JSONObject that contains all the data for a dvd movie instead of...
Read more >
JSONObject - Android Developers
Although this class is nonfinal, it was not designed for inheritance and should not be ... so this is lossy; use strings to...
Read more >
Android - JSON Parser - Tutorialspoint
This chapter explains how to parse the JSON file and extract necessary information from it. Android provides four different classes to manipulate JSON...
Read more >
JSON Parsing Tutorial With Example In Android Studio [Step ...
A JSONObject represents the data in the form of key and value pair. JSONObject values may be any mix of other JSONObjects, JSONArrays,...
Read more >
Introduction to JSON-Java (org.json) - Baeldung
Learn the fundamentals of parsing and manipulating JSON data with the JSON-Java library.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found