Closed Bug 1399782 Opened 8 years ago Closed 8 years ago

Pasting a JSON object in DevTools Console should show as console.log

Categories

(DevTools :: Console, defect)

57 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 972530

People

(Reporter: petcuandrei, Unassigned)

Details

Attachments

(1 file)

Attached image console.png
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0 Build ID: 20170913220121 Steps to reproduce: Open devtolls console and paste this {a:"test", b:5} Actual results: It displayed an error. "SyntaxError: missing ; before statement" Expected results: It should have displayed a nice object just like if I were to type console.log({a:"test", b:5})
Component: Untriaged → Developer Tools: Console
Hello Andrei, I'm sure there is a bug somewhere for that. The problem is that we evaluate what's entered in the console input, and `{var a = 2; b = a * 2}` is a valid block in Javascript. We could detect that we have an object, and if so, log it, like Chrome does. In the meantime, as a workaround you can wrap your json inside parenthesis, i.e. `({a: "test"})`
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: