# How to represent a value as a syntactically correct string

**URL:** <https://discourse.julialang.org/t/how-to-represent-a-value-as-a-syntactically-correct-string/77667>\
**Category:** General Usage\
**Created:** [March 10, 2022, 6:41am UTC](https://discourse.julialang.org/t/how-to-represent-a-value-as-a-syntactically-correct-string/77667 "2022-03-10T06:41:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrey2185](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrey2185/32/9889_2.png) [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Post date:** [March 10, 2022, 6:41am UTC](https://discourse.julialang.org/t/how-to-represent-a-value-as-a-syntactically-correct-string/77667/1 "2022-03-10T06:41:32Z")

</div>

Hello, how to represent a simple value as a syntactically correct string?

for example, this is i do

```julia
represent(s::Symbol)::String = "Symbol(\"$s\")" 
represent(:abc) # -> "Symbol("abs")" 
# but have a bug
Symbol("\\\"a") != @eval $(Meta.parse(represent(Symbol("\\\"a"))))

```

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [March 10, 2022, 8:39am UTC](https://discourse.julialang.org/t/how-to-represent-a-value-as-a-syntactically-correct-string/77667/2 "2022-03-10T08:39:56Z")

</div>

`repr` does what you want, on most built-in types at least.
