How to format a multi line string with triple quotes inside in JSON file?

Md.Abdul Halim Rafi

I have markdown string to store in json file, so I am using multi line and so many things in the string. How can I store it in json object?

[
  { "title":  "Title of Ebook",
    "details": [
      {
        "head": "Introduction 1",
        "data": """It’s important to follow trends in your field to ensure you’re staying current on standards and protocols and perhaps more so in the field of coding. Programmers of all specialties can benefit from following 
#h this is a header
__italic__
industry-leading blogs to stay aware of the latest technologies.If you’re a coder of any sort you’ll want to subscribe to these useful programming blogs written by the top blogging coders.Each of these bloggers has made a name for themselves in the programming community by sharing relevant, high-quality information and tips for coders. They maintain their respective blogs well and keep current information posted on a regular basis.By following the best programming blogs you’ll find tips and shortcuts you may never have otherwise thought to try. Consider using an RSS feed reader through your phone or desktop browser to automatically download each new post from these top coding bloggers."""
      }
  }
]

When I will receive the string I will have the markdown style data from json.

SebastianK

Your object is not closed correctly. There are closing brackets missing.

Not sure if it answers your question but you can do it like this:

import 'dart:convert';

main(List<String> arguments) {
  var json = [
    {
      "title": "Title of Ebook",
      "details": [
        {
          "head": "Introduction 1",
          "data":
              """It’s important to follow trends in your field to ensure you’re staying current on standards and protocols and perhaps more so in the field of coding. Programmers of all specialties can benefit from following 
#h this is a header
__italic__
industry-leading blogs to stay aware of the latest technologies.If you’re a coder of any sort you’ll want to subscribe to these useful programming blogs written by the top blogging coders.Each of these bloggers has made a name for themselves in the programming community by sharing relevant, high-quality information and tips for coders. They maintain their respective blogs well and keep current information posted on a regular basis.By following the best programming blogs you’ll find tips and shortcuts you may never have otherwise thought to try. Consider using an RSS feed reader through your phone or desktop browser to automatically download each new post from these top coding bloggers."""
        }
      ]
    }
  ];

  var encodedJson = jsonEncode(json);

  print(encodedJson);

  var details = json[0]['details'] as List;
  print(details[0]['data']);
}

Este artículo se recopila de Internet, indique la fuente cuando se vuelva a imprimir.

En caso de infracción, por favor [email protected] Eliminar

Editado en
0

Déjame decir algunas palabras

0Comentarios
Iniciar sesiónRevisión de participación posterior

Artículos relacionados

How to grep a specific line with quotes and then compare something inside it

How to grep a specific line with quotes and then compare something inside it

How to use a define inside a format string?

How can I split a string input in Javascript by each spacebar, but not elements inside double "quotes", single 'quotes' or backticks

SSIS: how to handle a quote-qualified csv file with quotes inside quotes

How to eliminate newline inside json into one line?

How can I get a string between two quotes in a batch file?

How to convert a large set of data in a multi line string into a table of values?

How to add JArray inside a Json string

echo specific string inside quotes from variable

How to format a JSON string as a table using jq?

How to convert MongoDB archive file to JSON format?

How to drop a row in a JSON file with invalid format

psql insert json with double quotes inside strings

How to use golang to convert a multi-line json to one-line json?

How detect first index of each line inside a string with multiple lines?

How to grep for multiple strings in the same line inside a file with similar pattern?

Bash sqlite3 -line | How to convert to JSON format

How to filter a multi dimensional json file to match the input value

How to filter a multi dimensional json file to match the input value

Format of a VBP File reference line

Flutter convert String to Json with doubles quotes

How to search a string inside a zip file inside other zip file if any

How to find a string inside a XML like tag from a file in Python?

regex pattern highlight n sequence string words inside double quotes

awk split string on commas ignore if inside double quotes

How do you escape characters within a string (JSON format) in golang

Capture a block from multi line string

How to write a JSON file in pretty format using .Net

TOP Lista

CalienteEtiquetas

Archivo