Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON graph fix to handle unicode dict keys #989

Merged
merged 1 commit into from
Oct 22, 2013

Conversation

hagberg
Copy link
Member

@hagberg hagberg commented Oct 22, 2013

This fix allows unicode for attribute keys in the JSON graph format writers.

This code demonstrates the issue and should now work correctly

#  -*- coding: utf-8 -*-
import json
import networkx as nx
from networkx.readwrite import json_graph
G = nx.Graph()
q = u"qualité"
G.add_node(1, {q:q})
s = json_graph.node_link_data(G)
output = json.dumps(s, ensure_ascii=False)
data = json.loads(output)
H = json_graph.node_link_graph(data)

hagberg added a commit that referenced this pull request Oct 22, 2013
JSON graph fix to handle unicode dict keys
@hagberg hagberg merged commit 30a35ce into networkx:master Oct 22, 2013
@ghost ghost assigned hagberg Oct 22, 2013
@hagberg hagberg deleted the json-str branch December 22, 2013 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant