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.

Arrays and objects are shown as string

See original GitHub issue

🐛 Bug Report

Hi, I’m starting to use Flipper in my React Native project. When I log an object like:

{
    "glossary": {
        "title": "example glossary",
		"GlossDiv": {
            "title": "S",
			"GlossList": {
                "GlossEntry": {
                    "ID": "SGML",
					"SortAs": "SGML",
					"GlossTerm": "Standard Generalized Markup Language",
					"Acronym": "SGML",
					"Abbrev": "ISO 8879:1986",
					"GlossDef": {
                        "para": "A meta-markup language, used to create markup languages such as DocBook.",
						"GlossSeeAlso": ["GML", "XML"]
                    },
					"GlossSee": "markup"
                }
            }
        }
    }
}

It’s shown as a string. Screen Shot 2020-03-31 at 11 51 08

I don’t want to use debugger in my browser but browser shows it as Screen Shot 2020-03-31 at 11 54 52 which is very usefull for nested objects. Will you planning this feature ?

Environment

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:38
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

23reactions
mweststratecommented, Mar 31, 2020

Yes, we intend to support better object representations like that partially in the future, although it will probably not give the same experience, because the browser connects to the living objects, and can evaluate them lazily when they are being expanded and show the underlying part, while the Flipper integration has to serialize them (the log connection is unidirectional at this moment), but an serialized can grow unbounded large.

A simple solution might be to use console.log(JSON.stringify(object, null, 2)). Whether that works depends on the serializability of your object.

10reactions
mweststratecommented, Apr 8, 2021

JSON is now formatted in the logs plugin, but beyond that no improvements like lazily expanding objects and such are planned.

Read more comments on GitHub >

github_iconTop Results From Across the Web

If an array of Object is an Object, why is an array of String not a ...
array is an collection of objects or collection of primitive datatypes while string is a sequence of characters. as you know object is...
Read more >
Data Structures: Objects and Arrays - Eloquent JavaScript
Every string has a toUpperCase property. When called, it will return a copy of the string in which all letters have been converted...
Read more >
Array - JavaScript - MDN Web Docs
Returns a string representing the calling array and its elements. Overrides the Object.prototype.toString() method. Adds one or more elements ...
Read more >
Java String Array- Tutorial With Code Examples
String array is an array of objects. This is because each element is a String and you know that in Java, String is...
Read more >
Arrays of Objects | Think Java | Trinket
Just as you can create an array of String objects, you can create an array of Card objects. The following statement creates an...
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