-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed YAML converter indentation chars to 2 spaces instead of Tab.
- Loading branch information
1 parent
225a8e2
commit 4f80c6c
Showing
1 changed file
with
11 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Attribute VB_Name = "JSON" | ||
|
||
' VBA JSON parser, Backus-Naur form JSON parser based on RegEx v1.7 | ||
' Copyright (C) 2015-2018 omegastripes | ||
' VBA JSON parser, Backus-Naur form JSON parser based on RegEx v1.71 | ||
' Copyright (C) 2015-2019 omegastripes | ||
' [email protected] | ||
' https://github.com/omegastripes/VBA-JSON-parser | ||
' | ||
|
@@ -249,26 +249,26 @@ Private Sub SerializeElement(vElement As Variant, ByVal sIndent As String) | |
|
||
End Sub | ||
|
||
Function ToString(vJSON As Variant) As String | ||
Function ToYaml(vJSON As Variant) As String | ||
|
||
Select Case VarType(vJSON) | ||
Case vbObject, Is >= vbArray | ||
Set oChunks = CreateObject("Scripting.Dictionary") | ||
ToStringElement vJSON, "" | ||
ToYamlElement vJSON, "" | ||
oChunks.Remove 0 | ||
ToString = Join(oChunks.Items(), "") | ||
ToYaml = Join(oChunks.Items(), "") | ||
Set oChunks = Nothing | ||
Case vbNull | ||
ToString = "Null" | ||
ToYaml = "Null" | ||
Case vbBoolean | ||
ToString = IIf(vJSON, "True", "False") | ||
ToYaml = IIf(vJSON, "True", "False") | ||
Case Else | ||
ToString = CStr(vJSON) | ||
ToYaml = CStr(vJSON) | ||
End Select | ||
|
||
End Function | ||
|
||
Private Sub ToStringElement(vElement As Variant, ByVal sIndent As String) | ||
Private Sub ToYamlElement(vElement As Variant, ByVal sIndent As String) | ||
|
||
Dim aKeys() As Variant | ||
Dim i As Long | ||
|
@@ -283,7 +283,7 @@ Private Sub ToStringElement(vElement As Variant, ByVal sIndent As String) | |
aKeys = vElement.Keys | ||
For i = 0 To UBound(aKeys) | ||
.Item(.Count) = sIndent & aKeys(i) & ": " | ||
ToStringElement vElement(aKeys(i)), sIndent & vbTab | ||
ToYamlElement vElement(aKeys(i)), sIndent & " " | ||
If Not (i = UBound(aKeys)) Then .Item(.Count) = vbCrLf | ||
Next | ||
End If | ||
|
@@ -294,7 +294,7 @@ Private Sub ToStringElement(vElement As Variant, ByVal sIndent As String) | |
.Item(.Count) = vbCrLf | ||
For i = 0 To UBound(vElement) | ||
.Item(.Count) = sIndent & i & ": " | ||
ToStringElement vElement(i), sIndent & vbTab | ||
ToYamlElement vElement(i), sIndent & " " | ||
If Not (i = UBound(vElement)) Then .Item(.Count) = vbCrLf | ||
Next | ||
End If | ||
|