1
1
Attribute VB_Name = "JSON"
2
2
3
- ' VBA JSON parser, Backus-Naur form JSON parser based on RegEx v1.7
4
- ' Copyright (C) 2015-2018 omegastripes
3
+ ' VBA JSON parser, Backus-Naur form JSON parser based on RegEx v1.71
4
+ ' Copyright (C) 2015-2019 omegastripes
5
5
6
6
' https://github.com/omegastripes/VBA-JSON-parser
7
7
'
@@ -249,26 +249,26 @@ Private Sub SerializeElement(vElement As Variant, ByVal sIndent As String)
249
249
250
250
End Sub
251
251
252
- Function ToString (vJSON As Variant ) As String
252
+ Function ToYaml (vJSON As Variant ) As String
253
253
254
254
Select Case VarType(vJSON)
255
255
Case vbObject, Is >= vbArray
256
256
Set oChunks = CreateObject("Scripting.Dictionary" )
257
- ToStringElement vJSON, ""
257
+ ToYamlElement vJSON, ""
258
258
oChunks.Remove 0
259
- ToString = Join(oChunks.Items(), "" )
259
+ ToYaml = Join(oChunks.Items(), "" )
260
260
Set oChunks = Nothing
261
261
Case vbNull
262
- ToString = "Null"
262
+ ToYaml = "Null"
263
263
Case vbBoolean
264
- ToString = IIf (vJSON, "True" , "False" )
264
+ ToYaml = IIf (vJSON, "True" , "False" )
265
265
Case Else
266
- ToString = CStr(vJSON)
266
+ ToYaml = CStr(vJSON)
267
267
End Select
268
268
269
269
End Function
270
270
271
- Private Sub ToStringElement (vElement As Variant , ByVal sIndent As String )
271
+ Private Sub ToYamlElement (vElement As Variant , ByVal sIndent As String )
272
272
273
273
Dim aKeys() As Variant
274
274
Dim i As Long
@@ -283,7 +283,7 @@ Private Sub ToStringElement(vElement As Variant, ByVal sIndent As String)
283
283
aKeys = vElement.Keys
284
284
For i = 0 To UBound(aKeys)
285
285
.Item(.Count) = sIndent & aKeys(i) & ": "
286
- ToStringElement vElement(aKeys(i)), sIndent & vbTab
286
+ ToYamlElement vElement(aKeys(i)), sIndent & " "
287
287
If Not (i = UBound(aKeys)) Then .Item(.Count) = vbCrLf
288
288
Next
289
289
End If
@@ -294,7 +294,7 @@ Private Sub ToStringElement(vElement As Variant, ByVal sIndent As String)
294
294
.Item(.Count) = vbCrLf
295
295
For i = 0 To UBound(vElement)
296
296
.Item(.Count) = sIndent & i & ": "
297
- ToStringElement vElement(i), sIndent & vbTab
297
+ ToYamlElement vElement(i), sIndent & " "
298
298
If Not (i = UBound(vElement)) Then .Item(.Count) = vbCrLf
299
299
Next
300
300
End If
0 commit comments