1

This object is too big for google chrome to let me copy and paste it from console. It also parses the strings so I would even then have to manually put in the quotes after getting the object. Is there another way to get my answer that I’m just overlooking?

SOLUTION/EDIT: I can't quite remember why I specifically needed to do this, but the solution was to use a text editor that can handle large files (e.g Sublime) and copy and paste it to the console from there.

Thank you to all

Austin Kim
  • 47
  • 11
  • 2
    Why do you need to copy and paste it? – gcampbell Jul 12 '16 at 07:17
  • You can create a file from it using a data URI. – Titus Jul 12 '16 at 07:18
  • 3
    [There's no such thing as a "JSON Object"](http://benalman.com/news/2010/03/theres-no-such-thing-as-a-json/) – Andreas Jul 12 '16 at 07:19
  • Here you can find more details on how you can do that http://stackoverflow.com/questions/3665115/create-a-file-in-memory-for-user-to-download-not-through-server – Titus Jul 12 '16 at 07:19
  • So let me get this straight: your problem is not actually parsing the JSON the way you describe in the question. Your problem is **passing obscenely large text blocks between console and Chrome using the clipboard** (the fact the text contains JSON being largely irrelevant). – SF. Jul 12 '16 at 07:46
  • Although I don't get the _why_,,, `copy(JSON.stringify(yourObject, null, 4))` stores a well formatted string representation of `yourObject` in the clipboard. `copy()` is only available in the console of Firefox and Chrome! – Andreas Jul 12 '16 at 07:52

2 Answers2

0

interesting, maybe you could try posting it to http://requestb.in/, something like:

$.post("http://requestb.in/...", json);

iloahz
  • 4,491
  • 8
  • 23
  • 31
  • Thank you! First question asked on stackoverflow, sorry if it wasn't clear enough or precise enough. This was definitely one of my weirder scenarios for help. Question got answered though; thanks a bunch Topro – Austin Kim Jul 13 '16 at 17:42
0

you could loop through the JSON-Object properties and set every entry to 1 manual.

//example jsobject
var jsonObject = {
  "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-kup languages such as DocBook.",
            "GlossSeeAlso": ["GML", "XML"]
          },
          "GlossSee": "markup"
        }
      }
    }
  }
};
for (var prop in jsonObject) {
  // skip loop if the property is from prototype and though is a subobject
  if (!jsonObject.hasOwnProperty(prop)) continue;
  //set it to 1
  jsonObject[prop] = 1;
}
console.log(jsonObject);
Georg.Duees
  • 154
  • 6
  • You could use something like compression to compress the output of the JSON-Object / your new JSON-Object via some js-scripts like [LZMA-JS](https://nmrugg.github.io/LZMA-JS/demos/advanced_demo.html).. this will compress / make the amount of data smaller so you could copy it to the clipboard. – Georg.Duees Jul 12 '16 at 07:56
  • When you convert it later via atob to base64 you can compress the output even more... – Georg.Duees Jul 12 '16 at 08:15