Skip to content

Commit

Permalink
Added the custom parsing case. (#48)
Browse files Browse the repository at this point in the history
* Added the custom parsing case.
  • Loading branch information
parth-dadhaniya authored and bhogayatakb committed Dec 4, 2024
1 parent ab80243 commit 5968c02
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/ottl/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"context"
"encoding/binary"
"encoding/hex"
"encoding/json"
"fmt"
"reflect"
"strconv"
Expand Down Expand Up @@ -427,6 +428,10 @@ func (g StandardPMapGetter[K]) Get(ctx context.Context, tCtx K) (pcommon.Map, er
return pcommon.Map{}, err
}
return m, nil
case string:
var jsonData pcommon.Map
errUnmarshal := json.Unmarshal([]byte(val.(string)), &jsonData)
return jsonData, errUnmarshal
default:
return pcommon.Map{}, TypeError(fmt.Sprintf("expected pcommon.Map but got %T", val))
}
Expand Down

0 comments on commit 5968c02

Please sign in to comment.