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.

MarkupHelper.createCodeBlock(json,CodeLanguage.JSON); is not displaying json properly

See original GitHub issue

I have used the code from the official website. http://extentreports.com/docs/versions/4/java/#markup-helpers-codeblock

String json = "{'foo' : 'bar', 'foos' : ['b','a','r'], 'bar' : {'foo':'bar', 'bar':false,'foobar':1234}}"; Markup m1 = MarkupHelper.createCodeBlock(json,CodeLanguage.JSON); testextent.pass(m1);

The report generated using this code is not displaying properly. Please find the screenshot Screenshot (159)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
anshooaroracommented, Jun 6, 2020

This is fixed in 5.0.0-SNAPSHOT.

However, not all features are available yet. More here: https://github.com/extent-framework/extentreports-java/tree/v5.0.x?files=1

0reactions
vijayatmautocommented, Apr 21, 2020

Hi Anshoo, Thanks for your quick response before. As you suggested, I have used ExtentSparkReporter to generate the report. But I still face the same issue.

Report config > ExtentSparkReporter sparkReporter = new ExtentSparkReporter(reportPath); sparkReporter.config().setDocumentTitle("Sample Automation"); sparkReporter.config().setReportName("Automation Run"); sparkReporter.config().setTheme(Theme.DARK); sparkReporter.config().setEncoding("utf-8"); extent = new ExtentReports(); extent.attachReporter(sparkReporter);

Test > testextent = extent.createTest("Code"); String json = "{'foo' : 'bar', 'foos' : ['b','a','r'], 'bar' : {'foo':'bar', 'bar':false,'foobar':1234}}"; testextent.pass(MarkupHelper.createCodeBlock(json, CodeLanguage.JSON)); testextent.log(Status.INFO,MarkupHelper.createCodeBlock(json, CodeLanguage.JSON) );

Have attached the screenshot of the report.

Screenshot (163)

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON Data Not Displaying Correctly in HTML - Stack Overflow
Your JSON structure is not how it should be. If the first object is how it should be (judging by the fact that...
Read more >
Working with JSON - Learn web development | MDN
In this article, we've given you a simple guide to using JSON in your programs, including how to create and parse JSON, and...
Read more >
JSON Files - Spark 3.3.1 Documentation
Property Name Default Scope primitivesAsString false read prefersDecimal false read allowComments false read
Read more >
Python Pretty Print JSON - DigitalOcean
We can use the Python json module to pretty-print the JSON data. The json module is recommended to work with JSON files.
Read more >
ConvertFrom-Json (Microsoft.PowerShell.Utility)
The ConvertFrom-Json cmdlet converts a JavaScript Object Notation (JSON) formatted string to a custom PSObject or Hashtable object that has a property for ......
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