Skip to content

Commit

Permalink
Fixed bug and only check for first key char for ext Json
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnAD committed Dec 25, 2019
1 parent d3aa6b5 commit 9d54157
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Introduction to bson
==============================================================================
ver 1.1.1
ver 1.1.2

.. image:: https://raw.githubusercontent.com/yglukhov/nimble-tag/master/nimble.png
:height: 34
Expand Down
2 changes: 1 addition & 1 deletion bson.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "1.1.1"
version = "1.1.2"
author = "John Dupuy"
description = "BSON (Binary Json) serialization"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion docs/bson-ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ interpretExtendedJson
proc interpretExtendedJson*(j: JsonNode): Bson =
source line: `1871 <../src/bson.nim#L1871>`__
source line: `1874 <../src/bson.nim#L1874>`__

Convert a JsonNode object (from the ``json`` Nim library) to a
Bson object.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Introduction to bson
==============================================================================
ver 1.1.1
ver 1.1.2

BSON

Expand Down
7 changes: 5 additions & 2 deletions src/bson.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,10 @@ proc interpExtJsonObject(j: JsonNode, foundKeyword: string): Bson =
try:
dt = parseTime(j[foundKeyword].str, "yyyy-MM-dd'T'HH:mm:sszzz", utc())
except:
dt = parseTime(j[foundKeyword].str, "yyyy-MM-dd'T'HH:mm:ss'.'fffzzz", utc())
try:
dt = parseTime(j[foundKeyword].str, "yyyy-MM-dd'T'HH:mm:ss'.'fffzzz", utc())
except:
dt = parseTime(j[foundKeyword].str, "yyyy-MM-dd'T'HH:mm:ss", utc())
result = toBson(dt)
elif j[foundKeyword].kind == JObject:
let dt = fromMilliseconds(parseInt(j[foundKeyword]["$numberLong"].str))
Expand Down Expand Up @@ -1853,7 +1856,7 @@ proc interpExtJsonRecurse(j: JsonNode): Bson =
of JObject:
var extendedKeyword = ""
for key in j.keys():
if key.contains("$"):
if key.startsWith("$"):
extendedKeyword = key
break
if len(extendedKeyword) > 0:
Expand Down

0 comments on commit 9d54157

Please sign in to comment.