how to convert a base64 into json, separate the content in diferents variables for consume from another program?

Viewed 26

I have this base64:

eyJ2ZXIiOjEsImZlY2hhIjoiMjAyMi0wOC0wNCIsImN1aXQiOjIwMjM4MzUwOTY1LCJwdG9WdGEiOjIsInRpcG9DbXAiOjEsIm5yb0NtcCI6MjU1MSwiaW1wb3J0ZSI6MjkyODIsIm1vbmVkYSI6IlBFUyIsImN0eiI6MSwidGlwb0RvY1JlYyI6ODAsIm5yb0RvY1JlYyI6MzA3MDc3MzE2MDEsInRpcG9Db2RBdXQiOiJFIiwiY29kQXV0Ijo3MjMxNTY5NzQ1MTcwNX0=

that translate to:

{"ver":1,"fecha":"2022-08-04","cuit":20238350965,"ptoVta":2,"tipoCmp":1,"nroCmp":2551,"importe":29282,"moneda":"PES","ctz":1,"tipoDocRec":80,"nroDocRec":30707731601,"tipoCodAut":"E","codAut":72315697451705}

so, the request is take this base64 transform into json, then separate into "ver" "fecha" "cuit" etc, etc and then set the data on every tittle ("ver":1 ,"fecha":"2022-08-04","cuit":20238350965, etc etc )

it need to be in visual studio 2012 on framework 3.5 because after doing this i'm gonna consume in another program(Centura) (its the only way to use it)

Create the "QRlibreriaClass.vb"

Imports System.Text
Imports Newtonsoft.Json
Imports Comprobante

<ComClass(QRLibreriaClass.ClassId, QRLibreriaClass.InterfaceId, QRLibreriaClass.EventsId)> _
Public Class QRLibreriaClass

#Region "GUID de COM"

    Public Const ClassId As String = "5b7ab7ef-c048-468c-9e83-9cbe99c946ff"
    Public Const InterfaceId As String = "3dc83518-8e1c-4297-a699-63457827d420"
    Public Const EventsId As String = "609f523d-4aa7-4b4e-b86c-d99ff7c9b67b"
#End Region

    Public Sub New()
        MyBase.New()
    End Sub



    Public JsonFromBase64 As String
    Public Json As String

    Public Sub setJsonFromBase64(ByVal _Json As String)
        JsonFromBase64 = _Json
        Json = Encoding.UTF8.GetString(Convert.FromBase64String(_Json))
        Dim obj As Object
    obj = JsonConvert.DeserializeObject<Comprobante>(json);

    End Sub

then i need to create new propertys for set on every tittle and throw into the first part?

i'm new on VB.NET and didnt know the right syntax, im learning but its complicated the request for a new one

0 Answers
Related