TradingAgents/agent_os/frontend/node_modules/flatted/golang
Ahmet Guzererler 7dd7a5c0b6 fix: migrate backend to port 8088 and use 127.0.0.1 to avoid macOS system conflicts
- move backend port from 8001 to 8088
- update frontend to use 127.0.0.1 explicitly instead of localhost
- add request/response logging middleware to backend
- fix explicit CORS origin matching for browser compatibility
2026-03-22 22:51:09 +01:00
..
pkg/flatted fix: migrate backend to port 8088 and use 127.0.0.1 to avoid macOS system conflicts 2026-03-22 22:51:09 +01:00
README.md fix: migrate backend to port 8088 and use 127.0.0.1 to avoid macOS system conflicts 2026-03-22 22:51:09 +01:00

README.md

flatted (Go)

A super light and fast circular JSON parser.

Usage

package main

import (
	"fmt"
	"github.com/WebReflection/flatted/golang/pkg/flatted"
)

type Group struct {
	Name string `json:"name"`
}

type User struct {
	Name   string `json:"name"`
	Friend *User  `json:"friend"`
	Group  *Group `json:"group"`
}

func main() {
	group := &Group{Name: "Developers"}
	alice := &User{Name: "Alice", Group: group}
	bob := &User{Name: "Bob", Group: group}

	alice.Friend = bob
	bob.Friend = alice // Circular reference

	// Stringify Alice
	s, _ := flatted.Stringify(alice)
	fmt.Println(s)
	// Output: [{"name":"Alice","friend":"1","group":"2"},{"name":"Bob","friend":"0","group":"2"},{"name":"Developers"}]

	// Flattening in action:
	// Index "0" is Alice, Index "1" is Bob, Index "2" is the shared Group.

	// Parse back into a generic map structure
	res, _ := flatted.Parse(s)
	aliceMap := res.(map[string]any)
	fmt.Println(aliceMap["name"]) // Alice
}

CLI

Build the binary using the provided Makefile:

make build

Then use it to parse flatted JSON from stdin:

echo '[{"a":"1"},"b"]' | ./flatted