<p>Short answer: no, there isn't a "standard" method, and there won't be.</p>

<p>Long answer: like TAB-delimited and XML, JSON alone is not a specific format. You have to define a schema to give meanings to data. However, unlike TAB-delimited "format" and XML, there is not an official way to define JSON schema. There have been various attempts but all of them are complicated and none of them are widely adopted. As you can't write down a JSON schema for GFA in the first place, there won't be a "standard" way to convert GFA to JSON. The best you can do is to roll out your own in-house solution, unfortunately.</p>

CC BY-SA 4.0
2018-05-22T08:15:56.787Z
Thanks. "There have been various attempts but all of them are complicated and none of them are widely adopted." Just to clarify though, why couldn't the community adopt a JSON scheme for GFA? If you encode all information of a GFA into one JSON format, it would be easy for others to modify this if they wish, right?
EB2127
CC BY-SA 4.0
2018-05-22T12:33:50.577Z
You are now asking a different question: why not use JSON to encode graphs? This question was answered in the thread you quoted.
user172818
CC BY-SA 4.0
2018-05-24T15:09:36.900Z
" in memory, a JSON object is also fatter, which can be a concern for huge graphs." This reason?
EB2127
CC BY-SA 4.0
2018-05-21T16:55:38.860Z
2018-05-21T16:55:38.860Z
user172818
<p>I'm confused why the <a href="https://github.com/GFA-spec/GFA-spec" rel="nofollow noreferrer">GFA format</a> doesn't have a standard JSON parser. It appears to be related to a decision made several years ago, <a href="https://github.com/GFA-spec/GFA-spec/issues/15" rel="nofollow noreferrer">here</a>.</p>

<p>The objection appears to be "JSON isn't necessary, as it's just a simple linked list. Users could write their own". However, I would think this is a useful feature. </p>

<p>There are applications I could think of whereby a JSON would be necessary, or at least very convenient. </p>

<p>(1) Is there a standard way to convert GFA into JSON? Or do users write their own scripts? </p>

<p>(2) Is there a conceptual reason why GFA doesn't convert into JSON? </p>

CC BY-SA 4.0
2018-05-20T12:45:57.203Z
I thought the explanation Heng gave was pretty comprehensive: it’s overkill, and you can use JSON in tags. Of course you shouldn’t write your own parser, there are enough existing ones.
Konrad Rudolph
CC BY-SA 4.0
2018-05-22T08:12:03.020Z
@KonradRudolph "there are enough existing ones." Do you have recommendations? Heng Li mentions his own in that thread, but there are others?
EB2127
CC BY-SA 4.0
2018-05-22T09:56:20.717Z
My recommendation is to use the standard library in whatever language you’re using. If that language doesn’t have a JSON parser in the standard library, use the most widely used implementation.
Konrad Rudolph
CC BY-SA 4.0
2018-05-24T15:06:55.607Z
@KonradRudolph "use the most widely used implementation" What is this?
EB2127
CC BY-SA 4.0
2018-05-24T15:08:35.250Z
That’s the point: it depends on the programming language. A simple search of “JSON” + name of the programming language should have it as the first or second hit.
Konrad Rudolph
CC BY-SA 4.0
2018-05-26T12:25:53.707Z
@KonradRudolph Oh, I understand what you meant by the comment above now. I was thinking you meant a specific JSON parser for GFAs.
EB2127
<assembly>
Why isn't there a standard method to convert GFA to JSON?
# Why isn't there a standard method to convert GFA to JSON?

(Asked by: username_0 on 2018-05-18)

I'm confused why the [GFA format](https://github.com/GFA-spec/GFA-spec) doesn't have a standard JSON parser. It appears to be related to a decision made several years ago, [here](https://github.com/GFA-spec/GFA-spec/issues/15).

The objection appears to be "JSON isn't necessary, as it's just a simple linked list. Users could write their own". However, I would think this is a useful feature.

There are applications I could think of whereby a JSON would be necessary, or at least very convenient.

(1) Is there a standard way to convert GFA into JSON? Or do users write their own scripts?

(2) Is there a conceptual reason why GFA doesn't convert into JSON?

**Tags:** assembly
> **Comments:**
> **username_1**: I thought the explanation Heng gave was pretty comprehensive: it’s overkill, and you can use JSON in tags. Of course you shouldn’t write your own parser, there are enough existing ones.  
> **username_0**: @KonradRudolph "there are enough existing ones." Do you have recommendations? Heng Li mentions his own in that thread, but there are others?  
> **username_1**: My recommendation is to use the standard library in whatever language you’re using. If that language doesn’t have a JSON parser in the standard library, use the most widely used implementation.  
> **username_0**: @KonradRudolph "use the most widely used implementation" What is this?  
> **username_1**: That’s the point: it depends on the programming language. A simple search of “JSON” + name of the programming language should have it as the first or second hit.  
> **username_0**: @KonradRudolph Oh, I understand what you meant by the comment above now. I was thinking you meant a specific JSON parser for GFAs.  

---

## 1 answers

### Answer by username_2 on 2018-05-21. Score: 4 | Accepted answer

Short answer: no, there isn't a "standard" method, and there won't be.

Long answer: like TAB-delimited and XML, JSON alone is not a specific format. You have to define a schema to give meanings to data. However, unlike TAB-delimited "format" and XML, there is not an official way to define JSON schema. There have been various attempts but all of them are complicated and none of them are widely adopted. As you can't write down a JSON schema for GFA in the first place, there won't be a "standard" way to convert GFA to JSON. The best you can do is to roll out your own in-house solution, unfortunately.

> **Comments:**
> **username_0**: Thanks. "There have been various attempts but all of them are complicated and none of them are widely adopted." Just to clarify though, why couldn't the community adopt a JSON scheme for GFA? If you encode all information of a GFA into one JSON format, it would be easy for others to modify this if they wish, right?  
> **username_2**: You are now asking a different question: why not use JSON to encode graphs? This question was answered in the thread you quoted.  
> **username_0**: " in memory, a JSON object is also fatter, which can be a concern for huge graphs." This reason?  

---

